MYSQL数据库安装-rpm安装方式

rpm 安装

1.下载安装包并解压安装

点击下载rpm包→阿里云盘分享(本次使用的是mysql5.7.29的安装包)

tar xzvf mysql.tar.gz
#卸载本地的mariadb、mysql
rpm -qa | grep -i -E mariadb\|mysql | xargs -n1 rpm -e --nodeps 
rpm -ivh 01_mysql-community-common-5.7.29-1.el7.x86_64.rpm 
rpm -ivh 02_mysql-community-libs-5.7.29-1.el7.x86_64.rpm 
rpm -ivh 03_mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm 
rpm -ivh 04_mysql-community-client-5.7.29-1.el7.x86_64.rpm 
rpm -ivh 05_mysql-community-server-5.7.29-1.el7.x86_64.rpm --force --nodeps 

systemctl start mysqld && systemctl enable mysqld.service

2.查询数据库初始密码

grep "temporary password is generated" /var/log/mysqld.log

3.初始化数据库

mysql_secure_installation

4.进行数据库密码和安全设置

Securing the MySQL server deployment.
Enter password for user root: #输入第四步获取的密码
The existing password for the user account root has expired. Please set a new password.
New password: #设置新密码
Re-enter new password: #再输入一遍
#密码一般需要大小写数字+特殊符号
Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y #是否更改密码 y
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 | y表示是,按任何其他键表示否,这里我直接跳过
... skipping.
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) : #是否禁用root用户远程登录,根据自己的需求选择Y/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) : #是否删除test数据库,直接回车
... skipping.
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) : #是否重新加载权限表,直接回车
... skipping.
All done! 
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章