日期:2014-05-16  浏览次数:20673 次

linux下mysql常见问题,个人实践
1,问题:
启动 mysql 服务的时候报如下错误:

Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

解决方法:

mysql_install_db --user=mysql  初始化数据库即可


2,
ps -ef|grep mysql 查看是否正确配置my.cnf
配置my.cnf
./mysqld_safe --defaults-file=/etc/my.cnf –user=mysql
3,
linux下mysql建立数据库一样要指定编码,不然会发生灾难性后果.有前车之鉴.

4,添加用户  用户名:yxp 密码:123456
grant all on *.* to yxp@'%' identified by '123456'
flush privileges  这个命令是刷新权限的命令
grant privileges... 也可以这样开头

5,mysql不能随系统启动时候,试试下面的命令
chkconfig --list mysql
chkconfig --add mysql 345 on
chkconfig --add mysql


6,外部的机器不能访问mysql,有可能是防火墙的原因,试试下面的命令


关闭防火墙
service iptables stop

彻底关闭
chkconfig iptables off


7,mysql忽略大小写,
在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务。
注意:这句不能放在最后一行,而是mysqld后面.