Ubuntu 20.04 修改 mysql 8.0.15 roo

2023-12-21  本文已影响0人  Rinaloving

修改 mysql root 密码

1. 进入mysql 安装目录
cd  /usr/local/mysql/bin
2. 登录mysql
su: Authentication failure
hyqzf202@hyqzf:/usr/local/mysql/bin$ sudo -i
root@hyqzf:~# cd /usr/local/mysql/bin/
root@hyqzf:/usr/local/mysql/bin# ./mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3189
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
3. 修改密码
alter user 'root'@'%' identified by 'root';
flush privileges;

修改 mysql 端口号

1.停止 mysql 服务
service mysqld stop
image.png
2. 在 my.cnf 文件中的 [mysqld] 下面 加上 port=3388
port = 新端口号
image.png
3. 重启mysql
service mysqld start
image.png
上一篇下一篇

猜你喜欢

热点阅读