美文网首页
mysql初使用修改密码及远程登陆

mysql初使用修改密码及远程登陆

作者: 苏南丶 | 来源:发表于2019-07-19 17:45 被阅读0次
  1. 第一步:查看密码
root@evo:sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = cfhuKqdMEd8ozBb2
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = cfhuKqdMEd8ozBb2
socket   = /var/run/mysqld/mysqld.sock
  1. 第二步:进入数据库修改密码
root@evo: mysql -u debian-sys-maint -p
Enter password: 

mysql> use mysql;
mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
mysql> update user set plugin="mysql_native_password"; 
mysql> flush privileges;
  1. 第三步:修改远程访问
mysql> grant all on *.* to 'root'@'%' identified by '123456';
mysql> flush privileges;
mysql> quit
  1. 第四步:重启数据库
root@evo: service mysql restart

相关文章

网友评论

      本文标题:mysql初使用修改密码及远程登陆

      本文链接:https://www.haomeiwen.com/subject/biislctx.html