第一个问题:
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 (没有启动mysql服务)
已经尝试遍了网上搜寻的所有解决办法,最后按照同事的提示,重新编译安装吧,然后重新编译安装!
然后就通过了,可以正常登录!比较无语!