[root@linuxServer ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)如何解决?
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)如何解决?
1.#ps -A|grep mysql
显示类似:
1829 ? 00:00:00 mysqld_safe
1876 ? 00:00:31 mysqld
2.#kill -9 1829
3.#kill -9 1876
4.#/etc/init.d/mysql restart
5.#mysql -u root -p
mysql> show grants for 'nian.zhang' \G;
*************************** 1. row ***************************
Grants for nian.zhang@%: GRANT SELECT, UPDATE, DELETE, CREATE, DROP, INDEX, SUPER, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'nian.zhang'@'%' IDENTIFIED BY PASSWORD '*5CCE2565AAAC88BA466E2EC67E7362AA8C050981'
1 row in set (0.00 sec)我给远程用户授予权限了
可是还是登陆不上去 查看log
100920 11:51:53 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'on.000001' at postion 357
100920 11:51:53 [ERROR] Error reading packet from server: Access denied; you need the REPLICATION SLAVE privilege for this operation ( server_errno=1227)这是为什么?
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@% |
+----------------+
1 row in set (0.01 sec)mysql> show binary logs;
ERROR 1227 (42000): Access denied; you need the SUPER privilege for this operation
mysql --protocol=TCP -uroot -p -P3306 -hlocalhost
这个试过了么?
[root@linuxServer etc]# mysql --protocol=TCP -uroot -p -P3306 -hlocalhost
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 184
Server version: 5.1.31-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
没问题
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 187
Server version: 5.1.31-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>客户端也没问题
然后再远程用该创建的用户登陆
执行
show slave status;看看是否权限加上了我的没加上mysql> show slave status;
ERROR 1227 (42000): Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation