centos 安装mysql8.0.25

采用rpm包安装

下载地址:https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-x86_64/

 安装

yum -y install mysql-community-*

创建目录并修改权限

mkdir /data

chown -R mysql:mysql /data/

修改配置文件

复制代码
[mysqld]
socket=/data/mysql/mysql.sock

log-error=/data/mysql/mysqld.log
pid-file=/data/mysql/mysqld.pid
port=3306
datadir=/data/mysql
max_connections=5000
max_connect_errors=200
default-storage-engine=INNODB
bind-address=0.0.0.0
server_id=1
log_bin=mysql-bin
binlog_format=ROW

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
table_open_cache = 65535
open_files_limit = 65535

character-set-server=UTF8MB4

[mysql]
default-character-set=UTF8MB4

[client]
port=3306
default-character-set=UTF8MB4
复制代码

修改启动脚本

vi /usr/lib/systemd/system/mysqld.service

LimitNOFILE = 65535

重启查看日志,一定要保证日志无任何异常

运行以下命令,对MySQL进行安全性配置。

复制代码
sudo mysql_secure_installation

D:\mysql\mysql-8.0.29-winx64\bin> mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'default-character-set=UTF8MB4'.

Securing the MySQL server deployment.

Enter password for user root: ************

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
复制代码

 

 


posted @   不会跳舞的胖子  阅读(221)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示