centos6.9安裝MySQL5.6.44


一、檢查系統是否安裝其他版本的MYSQL數據
1 # yum list installed | grep mysql
2 # yum -y remove mysql-libs.x86_64
二、安裝及配置
1 # wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
2 # rpm -ivh mysql-community-release-el6-5.noarch.rpm
3 # yum repolist all | grep mysql
安裝MYSQL數據庫
1 # yum install mysql-community-server -y
設置為開機啟動(2、3、4都是on代表開機自動啟動)
1 # chkconfig --list | grep mysqld
2 # chkconfig mysqld on
三、設置遠程root
啟動mysql
1 # service mysqld start
設置root密碼
1 # mysql_secure_installation
登錄root賬號
1 # mysql -uroot -p 
建立遠程root用戶
1 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你設置的密碼' WITH GRANT OPTION;
2 mysql> flush privileges;
四、設置utf-8編碼
查看mysql原本編碼:
1 mysql> show variables like 'character%';
設置編碼 vi /etc/my.cnf
 1 [mysqld]
 2 character-set-server=utf8 
 3 collation-server=utf8_general_ci 
 4 performance_schema_max_table_instances=400 
 5 table_definition_cache=400 
 6 table_open_cache=256
 7 # 修改
 8 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 9 
10 [mysql]
11 default-character-set = utf8
12 
13 [mysql.server]
14 default-character-set = utf8
15 
16 
17 [mysqld_safe]
18 default-character-set = utf8
19 
20 
21 [client]
22 default-character-set = utf8

重啟mysql

1 # service mysqld restart

再次查看編碼:

 1 mysql> show variables like 'character%';
 2 +--------------------------+----------------------------+
 3 | Variable_name | Value |
 4 +--------------------------+----------------------------+
 5 | character_set_client | utf8 |
 6 | character_set_connection | utf8 |
 7 | character_set_database | utf8 |
 8 | character_set_filesystem | binary |
 9 | character_set_results | utf8 |
10 | character_set_server | utf8 |
11 | character_set_system | utf8 |
12 | character_sets_dir | /usr/share/mysql/charsets/ |
13 +--------------------------+----------------------------+
14 8 rows in set (0.00 sec)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM