centos6.5 安装mysql5.6

  1. yum install wget
  2. wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
  3. rpm -ivh mysql-community-release-el6-5.noarch.rpm
  4. ls -l /etc/yum.repos.d/mysql-community*
  5. yum install  mysql-community-server  
  6. chkconfig mysqld on  --开启开机启动的服务  
  7. chkconfig mysqld off --关闭服务。
  8. service mysqld start  

   初始化密码:

  mysql -u root

mysql> use mysql;

mysql> update user set password=PASSWORD("123456") where User='root';

mysql> flush privileges;

mysql> quit

 

 

开启远程访问

use mysql;

update user set host = '%' where user = 'root';    //这个命令执行错误时可略过

flush privileges;

select host, user from user; //检查‘%’ 是否插入到数据库中

quit

 

  delete from user where user ='';

 delete from user where user is NULL; 

修改字符编码

 

show variables like "%char%";

+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

 

character_set_database和character_set_server的默认字符集还是latin1。

2、在[mysqld]字段里加入character-set-server=utf8,如下:

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
character-set-server=utf8

 

 

 service mysqld restart;

 

 

 

 

 

 

 

你可能感兴趣的:(c)