linux下安装mysql my.cnf配置文件发生错误

问题:


[root@localhost etc]# service mysqld status
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
 ERROR! MySQL is not running



解决方法:
将my.cnf文件以ANSI格式保存即可


问题:
[root@localhost bin]# ./mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


解决方法:

将my.cnf配置文件中的 socket值改为 '/tmp/mysql.sock'



问题:
[root@localhost bin]# ./mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)



解决方法:
修改my.cnf
在mysqld下面添加:
[mysqld]
skip-grant-tables


你可能感兴趣的:(linux)