linux下mysql如何修改密码,包括本地密码和远程密码。navicat远程登录

当服务器部署mysql,navicat远程访问,修改密码时需要修改两次

1、修改本地登录密码

mysql > SET PASSWORD = PASSWORD('123456');
mysql > FLUSH PRIVILEGES;

重启mysql服务

service mysql restart

上面命令如果报错,则采取以下方法:

[root@]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
Failed to restart mysqld.service: Unit mysqld.service not found.
[root@]# whereis mysql
mysql: /usr/local/mysql /usr/local/mysql/bin/mysql
[root@]#  /etc/init.d/ | grep mysql
-bash: /etc/init.d/: Is a directory
[root@]# ll /etc/init.d/ | grep mysql
[root@]# find / -name mysql.server
/usr/local/mysql/support-files/mysql.server
[root@]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@]# service mysql restart
Shutting down MySQL.... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@]# service mysql stop
Shutting down MySQL.... SUCCESS! 
[root@]# service mysql start
Starting MySQL. SUCCESS! 

2、修改远程访问登录密码
在mysql的user表中
linux下mysql如何修改密码,包括本地密码和远程密码。navicat远程登录_第1张图片
刷新权限

FLUSH PRIVILEGES;

你可能感兴趣的:(服务器,mysql,linux,数据库)