• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

以前使用MySQL时的遇到有关问题整理

mysql 搞代码 7年前 (2018-06-05) 147次浏览 已收录 0个评论

以前使用mysql时的遇到问题整理

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: <输入新设的密码newpassword>

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


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:以前使用MySQL时的遇到有关问题整理

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址