1.ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
1.根据提示查看/tmp/mysql.sock文件,发现并未生产该文件
2.service mysqld status 检查服务状态,服务是已启动的
3.查看配置文件/etc/my.cnf,看到配置中mysql 的位置不为/tmp,进行修改
4.重启mysql服务
一切正常,yeah!
2.ERROR 1227 (42000):Access denied; you need the CREATE USER privilege for this operation
解决方案:
service mysqld stop
sudo mysqld_safe --skip-grant-table &
进入mysql,继续创建user,出现:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决方案:
flush privileges;
再次执行创建用户,成功
3. error 1044 (42000):access denied for user ''@'localhost' to database 'mysql'
解决方法:
sudo service mysqld stop
vim /etc/my.cnf
#在mysqldb下增加:
skip-grant-tables
sudo service mysqld start
再次进入mysql执行命令,成功
网友评论