Access denied for user 'root'@'localhost' (using password: Yes)或者No的解决
程序员文章站
2022-05-19 21:46:18
...
这个提示主要是因为root登录需要密码,而密码如果不正确的提示
主要通过修改mysql的配置来跳过权限限制,来实现登录
而可以通过修改my.cnf/my.ini增加--skip-grant-tables来跳过,也可以通过mysql启动增加参数来实现,不过两者都需要重新启动mysql
http://*.com/questions/19533441/access-denied-for-user-rootlocalhost-using-password-yes-after-password-r
Mac下的mysql目录为/usr/local/mysql/bin/,有时候会用到,如果配置环境变量了,可以直接使用下面的每一步操作
Follow steps below
1.启动mysqld的实例通过--skip-grant-tables参数,启动mysql,就可以跳过授权方式登录,修改完后别忘了再重启mysql
$ mysqld start --skip-grant-tables
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;
3.Finally, restart the instance/daemon without the --skip-grant-tables option.
$ /etc/init.d/mysql restart
4.You should be able to connect with your new password.
$ mysql -u root -p
Enter password: my_password
NEW UPDATE
Mysql Unable to lock ibdata1 error fix
sudo mv /usr/local/mysql/data/ibdata1 /usr/local/mysql/data/ibdata1.bak
sudo mv /usr/local/mysql/data/ib_logfile0 /usr/local/mysql/data/ib_logfile0.bak
sudo mv /usr/local/mysql/data/ib_logfile1 /usr/local/mysql/data/ib_logfile1.bak
sudo cp -a /usr/local/mysql/data/ibdata1.bak /usr/local/mysql/data/ibdata1
sudo cp -a /usr/local/mysql/data/ib_logfile0.bak /usr/local/mysql/data/ib_logfile0
sudo cp -a /usr/local/mysql/data/ib_logfile1.bak /usr/local/mysql/data/ib_logfile1
sudo /etc/init.d/mysql restart
主要通过修改mysql的配置来跳过权限限制,来实现登录
而可以通过修改my.cnf/my.ini增加--skip-grant-tables来跳过,也可以通过mysql启动增加参数来实现,不过两者都需要重新启动mysql
http://*.com/questions/19533441/access-denied-for-user-rootlocalhost-using-password-yes-after-password-r
Mac下的mysql目录为/usr/local/mysql/bin/,有时候会用到,如果配置环境变量了,可以直接使用下面的每一步操作
Follow steps below
1.启动mysqld的实例通过--skip-grant-tables参数,启动mysql,就可以跳过授权方式登录,修改完后别忘了再重启mysql
$ mysqld start --skip-grant-tables
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;
3.Finally, restart the instance/daemon without the --skip-grant-tables option.
$ /etc/init.d/mysql restart
4.You should be able to connect with your new password.
$ mysql -u root -p
Enter password: my_password
NEW UPDATE
Mysql Unable to lock ibdata1 error fix
sudo mv /usr/local/mysql/data/ibdata1 /usr/local/mysql/data/ibdata1.bak
sudo mv /usr/local/mysql/data/ib_logfile0 /usr/local/mysql/data/ib_logfile0.bak
sudo mv /usr/local/mysql/data/ib_logfile1 /usr/local/mysql/data/ib_logfile1.bak
sudo cp -a /usr/local/mysql/data/ibdata1.bak /usr/local/mysql/data/ibdata1
sudo cp -a /usr/local/mysql/data/ib_logfile0.bak /usr/local/mysql/data/ib_logfile0
sudo cp -a /usr/local/mysql/data/ib_logfile1.bak /usr/local/mysql/data/ib_logfile1
sudo /etc/init.d/mysql restart
推荐阅读
-
linux mysql忘记密码的多种解决或Access denied for user 'root'@'localhost'
-
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
-
MYSQL ERROR 1045 (28000): Access denied for user (using password: YES)问题的解决
-
ERROR 1045: Access denied for user: root@localhost (Using password: NO)
-
win10下MySQL 8.0登录Access denied for user‘root’@‘localhost’ (using password: YES)问题的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
java访问数据库被拒绝,不能连接数据库ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法