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


本文轉自:91博客;原文地址:http://www.9191boke.com/192454677.html



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

二、安裝及配置
# 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
設置為開機啟動(2、3、4都是on代表開機自動啟動)
# chkconfig --list | grep mysqld
# chkconfig mysqld on

三、設置遠程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;

 

四、設置utf-8編碼

查看mysql原本編碼:
mysql> show variables like 'character%';
設置編碼
# vi /etc/my.cnf
如下(少補):
[mysqld]
character-set-server=utf8 
collation-server=utf8_general_ci 
performance_schema_max_table_instances=400 
table_definition_cache=400 
table_open_cache=256
# 修改
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[mysql]
default-character-set = utf8

[mysql.server]
default-character-set = utf8


[mysqld_safe]
default-character-set = utf8


[client]
default-character-set = utf8

 

重啟mysql

# service mysqld restart

再次查看編碼:

     # 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)

 

 


免責聲明!

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



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