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

MySql linux 相关配置
1、字符集设置成UTF8
   修改/etc/my.cnf(如果没有,将mysql下的my-medium.conf拷贝至/etc下并修改名字成,my.cnf)
   在[client]和[mysqld]中添加
    default-character-set = utf8
    重启服务即可
2、修改MySQL密码
      (1.)
        SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
      

     (2.)
         mysql> use mysql;
         mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
         mysql> FLUSH PRIVILEGES;
       

     (3.) 
         mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
         mysql> FLUSH PRIVILEGES;
           

3、修改访问权限
           
         mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
         mysql> FLUSH PRIVILEGES;