参考:
https://help.aliyun.com/document_detail/97251.html?spm=a2c4g.11186623.0.0.5f804c61AbhHXu#section-sok-8r6-jr6文章来源地址https://www.toymoban.com/news/detail-401214.html
安装Mysql数据库
1.更新YUM源
sudo rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2.安装MySQL
sudo yum -y install mysql-community-server --nogpgcheck
3.MySQL版本
mysql -V
4.启动MySQL
sudo systemctl start mysqld
5.设置开机启动
sudo systemctl enable mysqld
sudo systemctl daemon-reload
6.获取并记录root用户的初始密码
sudo grep 'temporary password' /var/log/mysqld.log
7.配置MySQL的安全性
sudo mysql_secure_installation
1.输入MySQL的初始密码
Securing the MySQL server deployment.
Enter password for user root: #输入上一步获取的root用户初始密码
2.为MySQL设置新密码
The existing password for the user account root has expired. Please set a new password.
New password: #输入新密码。长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号包含()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/
Re-enter new password: #确认新密码。
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
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) :Y #您需要输入Y以确认使用新密码。
#新密码设置完成后,需要再次验证新密码。
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,再次确认使用新密码。
3.删除匿名用户
Remove anonymous users? (Press y|Y for Yes, any other key for No) :Y
Success.
4.禁止使用root用户远程登录MySQL
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :Y
Success.
5.删除test库以及用户对test库的访问权限
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.
6.加载授权表
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Y
Success.
All done!
文章来源:https://www.toymoban.com/news/detail-401214.html
到了这里,关于安装Mysql数据库的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!