mysql5.7 测试环境配置部署

数据库版本:Mysql 5.7.32 

数据库部署步骤如下:

[root@localhost software]# pwd

/data/software 

[root@localhost software]# ll

total 28

-rw-r--r--. 1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm

 

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 

yum -y install mysql57-community-release-el7-10.noarch.rpm 

yum -y install mysql-community-server 

如上Mysql安装完毕,接下来根据需要进行一些配置。

先启动Mysql:

systemctl start mysqld.service

查看mysql状态即是否启动:

systemctl status mysqld.service

查看mysql5.7默认root密码:

grep "password" /var/log/mysqld.log

 

使用默认mysql root登陆后修改密码:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'jxlJXL@123';

 

修改mysql5.7密码策略:暂略  注意:修改完密码策略后,需要重启mysql服务生效!

在防火墙开启有关端口,比如3306,看具体情况!配置防火墙需要重启防火墙服务才能生效!

 

修改Mysql字符编码(不修改会产生乱码):

 

mysql> show variables like '%character%';

+--------------------------+----------------------------+

| 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/ |

+--------------------------+----------------------------+

8 rows in set (0.00 sec)

 

more /etc/my.cnf

 

 

 

重启mysql数据库使配置生效:

systemctl restart mysqld.service

再次查看Mysql字符集:

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.01 sec)

如上所示修改字符集成功! 

至此,mysql数据库部署成功。

posted on 2021-01-15 14:36  永远的大空翼  阅读(144)  评论(0编辑  收藏  举报