Can't connect to local MySQL server 时 修改 root 用户名
1 由于不小心 root用户名和密码忘记了,但是通过网上的一种方式 http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html 出现Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)的错误,奇怪,mysql明明启动
1 由于不小心 root用户名和密码忘记了,但是通过网上的一种方式
http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html
出现 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)的错误,奇怪,mysql明明启动了,只好换另外一种方式
2 使用 phpmyadmin
(1) 修改MySQL的登录设置:
# vi /usr/local/mysql/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
(2) 重启 mysqld
/etc/init.d/mysqld restart
(3) 登录 phpmyadmin
首先用root账号登陆phpmyadmin,然后点击左侧进入mysql数据库,在顶部点击“mysql”进入sql输入界面。输入以下命令:
update user set password=password('123456') where User='root'
其中123456为你希望修改的密码,切记不要在数据库中直接手工修改密码。
推荐阅读
-
Can't connect to local MySQL server 时 修改 root 用户名
-
Linux登录MySQL时出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock'解决方法
-
Linux登录MySQL时出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock'解决方法
-
Can't connect to local MySQL server through socket &
-
MySQL "Can't connect to local mysql server
-
MySQL "Can't connect to local mysql server
-
ERROR 2002: Can't connect to local MySQL server thro
-
ERROR 2002: Can't connect to local MySQL server thro