使用MySQL时遇到的问题整理_MySQL
程序员文章站
2022-06-14 19:57:50
...
bitsCN.com
使用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 mysqlmysql> UPDATE userSET Password=PASSWORD('newpassword') where USER='root';mysql> FLUSHPRIVILEGES;mysql> quit # /etc/init.d/mysqlrestart# mysql -uroot -pEnter 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 -pmysql> 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 bitsCN.com
使用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 mysqlmysql> UPDATE userSET Password=PASSWORD('newpassword') where USER='root';mysql> FLUSHPRIVILEGES;mysql> quit # /etc/init.d/mysqlrestart# mysql -uroot -pEnter 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 -pmysql> 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 bitsCN.com
上一篇: php获取QQ头像并显示的方法_PHP
推荐阅读
-
使用cmd运行mysql数据库的时候,报错:"不是内部命令也不是可有运行的程序"问题的解决办法
-
MySQL插入时间差八小时问题的解决方法
-
mysql从执行.sql文件时处理\n换行的问题
-
MySQL嵌套事务所遇到的问题
-
mysql主从同步-percona-toolkit工具的使用整理
-
Win10环境下安装Mysql5.7.23问题及遇到的坑
-
web.py在SAE中的Session问题解决方法(使用mysql存储)
-
mysql启动时出现ERROR 2003 (HY000)问题的解决方法
-
Mysql5.7中使用group concat函数数据被截断的问题完美解决方法
-
Mysql数据库从5.6.28版本升到8.0.11版本部署项目时遇到的问题及解决方法