centos6.8 yum安裝mysql 5.6 (完整)

1、檢查系統是否安裝其餘版本的MYSQL數據
#yum list installed | grep mysql
#yum -y remove mysql-libs.x86_64mysql

2、安裝及配置
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql
安裝MYSQL數據庫
# yum install mysql-community-server -y
設置爲開機啓動(二、三、4都是on表明開機自動啓動)
# chkconfig --list | grep mysqld
# chkconfig mysqld onsql

3、設置遠程root
啓動mysql
# service mysqld start
設置root密碼
# mysql_secure_installation
登錄root帳號
# mysql -uroot -p 
創建遠程root用戶
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你設置的密碼' WITH GRANT OPTION;
mysql> flush privileges;
 數據庫

4、設置utf-8編碼編碼

查看mysql本來編碼:
mysql> show variables like 'character%';
設置編碼
# vi /etc/my.cnf
以下(少補):
複製代碼
[mysqld]
character-set-server=utf8 
collation-server=utf8_general_ci rest

[mysql]
default-character-set = utf8server

[mysql.server]
default-character-set = utf8utf-8


[mysqld_safe]
default-character-set = utf8ci


[client]
default-character-set = utf8
複製代碼
重啓mysqlrem

# service mysqld restart
再次查看編碼:get

複製代碼      # mysql -uroot -p mysql> show variables like 'character%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)  

相關文章
相關標籤/搜索