centos6.9安装MySQL5.6.44

centos6.9安装MySQL5.6.44
强烈推介IDEA2021.1.3破解激活,IntelliJ IDEA 注册码,2021.1.3IDEA 激活码  

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说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)

 

转载于:https://www.cnblogs.com/pan-louis/p/11004087.html

本文来源weixin_30595035,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/29760

发表评论