linux登录myql报错:linux Access denied for user 'root'@'localhost' (using password: YES)
今天启动linux的mysql成功后,使用下面的命令登录:mysql -u root -p要求输入密码,输入密码但是报如下的错误:linux Access denied for user 'root'@'localhost' (using password: YES)找不到root的密码,想着能不能登录的时候不适用密码,解决方式如下:1、先停止mysql 服务serv...
·
今天启动linux的mysql成功后,使用下面的命令登录:
mysql -u root -p
要求输入密码,输入密码但是报如下的错误:
linux Access denied for user 'root'@'localhost' (using password: YES)
找不到root的密码,想着能不能登录的时候不适用密码,解决方式如下:
1、先停止mysql 服务
service mysql stop
2、跳过密码验证:
[root@instance-f7npi0zx ~]# /usr/bin/mysqld_safe --skip-grant-tables
190619 15:52:21 mysqld_safe Logging to '/var/log/mysqld.log'.
190619 15:52:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
190619 15:52:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
证明成功
3、重启mysql
[root@instance-f7npi0zx ~]# service mysql start
4、不使用密码登录:
[root@instance-f7npi0zx ~]# mysql -u root
mysql> 出现mysql 证明登录成功
5、设置新密码:
mysql> set password=password('123456');
Query OK, 0 rows affected (0.00 sec)
6、退出后重新登录
mysql> exit
Bye
[root@instance-f7npi0zx ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25-log MySQL Community Server (GPL)
更多推荐
已为社区贡献1条内容
所有评论(0)