ubuntu

安装

sudo apt-get update

sudo apt-get install mysql-server mysql-client

设置root密码

cat /etc/mysql/debian.cnf 查看默认密码

mysql -u debian-sys-maint -p 连接输入密码

use mysql; select user,plugin from user;

update user set plugin='mysql_native_password' where user='root'; # 修改其密码格式 select user,plugin from user; # 查询其用户

alter user 'root'@'localhost' identified by '12345678';

update user set host = '%' where user = 'root';

flush privileges;

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉bind-address = 127.0.0.1:

重启

sudo service mysql restart

你可能感兴趣的:(ubuntu,linux,运维)