标签:
第一个问题:
root@b-ThinkPad-X230s:/usr/local/mysql/bin# ./mysqld_safe start (开启mysql的服务!)
151123 14:19:04 mysqld_safe Logging to ‘/usr/local/mysql/data/b-ThinkPad-X230s.err‘.
151123 14:19:04 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
151123 14:19:05 mysqld_safe mysqld from pid file /usr/local/mysql/data/b-ThinkPad-X230s.pid ended
root@b-ThinkPad-X230s:/usr/local/mysql/bin# ./mysql --user=mysql (使用mysql用户登录)
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2) (报错!)
以为是用户的问题,然后尝试换一个用户名:
root@b-ThinkPad-X230s:/usr/local/mysql/bin# ./mysql -u root (使用root用户登录)
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2) (报错!)
然后想着是否是没有用户设置密码的问题,因为貌似是不用密码也可以登录的,先尝试设置密码:
root@b-ThinkPad-X230s:/usr/local/mysql/bin# ./mysqladmin -u mysql password "123456"
./mysqladmin: connect to server at ‘localhost‘ failed
error: ‘Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)‘
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock‘ exists!
查看服务是否已经启动:
root@b-ThinkPad-X230s:/tmp# ps -aux | grep "mysql"
root 4518 0.0 0.0 13708 2296 pts/11 S+ 14:35 0:00 grep --color=auto mysql
标签:
原文地址:http://www.cnblogs.com/persistcat/p/4988436.html