您好,欢迎访问一九零五行业门户网

使用MySQL时的遇到问题整理

1 error 2002(hy000): can
1 error 2002(hy000): can't connect to local mysql server through socket' /var/lib/mysql/mysql.sock'(2)
未启动mysql mysql的问题
2 error 1045(28000): access denied for user 'root'@'localhost' (using password: no)
密码错了,修改root用户的密码:
2.1 方法一
mysqladmin -uroot -ppassword 'newpassword'
2.2 方法二
# /etc/init.d/mysql stop
# mysqld_safe--user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> update userset password=password('newpassword') where user='root';
mysql> flushprivileges;
mysql> quit
# /etc/init.d/mysqlrestart
# mysql -uroot -p
enter password:
3 can'tconnect to mysql server on '192.168.10.31' (10060)
ip写错了, 或者端口没有开放.
4 error 1130:host '192.168.1.3' is not allowed to connect to this mysql server
4.1 改表法
在localhost的那台电脑,登入mysql后,更改mysql数据库里的user表里的host项,,从localhost改成%
mysql -u root -p
mysql> use mysql;
mysql> update userset host = '%' where user = 'root';
mysql> select host,user from user;
4.2 授权法
mysql> grant all privilegeson *.* to 'yourname'@'%' identified by 'youpasswd';
query ok, 0 rowsaffected (0.05 sec)
mysql> flushprivileges;
query ok, 0 rowsaffected (0.06 sec)
mysql> exit
其它类似信息

推荐信息