1、4中字符集的问题
vi /etc/my.cnf
default-character-set=utf8
check-set-server=utf8
collation-server=utf_general_ci
2、slow log慢查询日志问题
vi /etc/my.cnf
log_slow_queries=slow.log
long_query_time=5
建议:Mysql> set log_slow_queries='on';
Mysql> set long_query_time=2;
3、socket问题
Mysql socket 无法登陆。登陆mysql时提示不能用socket登陆,此时换tcp方式去登陆,但是可以测试这样用。
# Mysql -uroot -p --protocol tcp -hlocalhost
这样就可以登陆。这样就不用mysql.sock来登陆,而Mysql.sock是启动Mysqld服务时产生的。
4、root密码丢失
a、service mysqld stop
b、mysqld_safe --skip-grant-tables --user=mysql& //跳过授权表mysql.user和mysql.db
c、mysql -uroot
d、set password=password("yourpasswd"); //出现报错是因为加上了--skip-grant-tables
f、Mysql> update user set password=password("yourpasswd") where user='root' and host='localhost';
e、Mysql> set password for root@localhost=password("yourpasswd");
g、Mysql> set password=password("yourpasswd");