使用MySQL时遇到的问题整理_MySQL
程序员文章站
2024-02-06 21:37:07
...
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
推荐阅读
-
MySQL 中字符串字段,在使用in时,没有加引号时的性能陷阱
-
【求助】php往mysql写数据遇到的问题
-
mysql-MySQL二进制日志使用遇到的编码问题
-
请问php 使用mysql_query时遇到的奇怪有关问题
-
MySQL之—使用c3p0与DBCP连接池,造成的MySql 8小时问题的详细代码解决方案
-
请教 mysql_unbuffered_query 遇到的问题
-
错误使用MySQL前缀索引导致的慢查询问题_MySQL
-
mysql-Mysql的 auto_increment 使用问题
-
解决MySQL 5.0的不能使用自动增加字段问题_MySQL
-
大家使用过mysql 严格模式没有?帮忙看一下这个简单的SQL语句出了什么问题?