Linux(Centos 8.2) 使用RPM包安装Mysql8.0.20
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux(Centos 8.2) 使用RPM包安装Mysql8.0.20,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5684字,纯文字阅读大概需要9分钟。
内容图文
![Linux(Centos 8.2) 使用RPM包安装Mysql8.0.20](/upload/InfoBanner/zyjiaocheng/863/8b617c37b2c5490099fabc88727a3e92.jpg)
1.准备所需的安装包:
应当按照common(依赖)–>libs(依赖)–>client(客户端)–>server(服务端)的顺序安装,否则安装过程会提醒依赖顺序,其他的为非必须安装包。
方法①:Mysql官网下载RPM包
方法②:直接使用 wget 指令下载(网易地址)
wget https://mirrors.163.com/mysql/Downloads/MySQL-8.0/mysql-community-common-8.0.20-1.el7.x86_64.rpm
wget https://mirrors.163.com/mysql/Downloads/MySQL-8.0/mysql-community-libs-8.0.20-1.el7.x86_64.rpm
wget https://mirrors.163.com/mysql/Downloads/MySQL-8.0/mysql-community-client-8.0.20-1.el7.x86_64.rpm
wget https://mirrors.163.com/mysql/Downloads/MySQL-8.0/mysql-community-server-8.0.20-1.el7.x86_64.rpm
2.检查是否安装过:
rpm -qa | grep -i mysql
3.卸载之前的安装:
rpm -e --nodeps 软件名 //强力删除,对相关依赖的文件也进行强力删除
4.安装RPM包:
?rpm -ivh mysql-community-common-XXXXXX.rpm?
rpm -ivh mysql-community-libs-XXXXXX.rpm?
rpm -ivh mysql-community-client-XXXXXX.rpm?
rpm -ivh mysql-community-server-XXXXXX.rpm
报错:
警告:mysql-community-server-5.7.24-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature.......
原因:这是由于yum安装了旧版本的GPG keys造成的
解决命令
sudo rpm -ivh --nodeps mysql-community-XXXXXX.rpm
或者 rpm -ivh mysql-xxxxxx.rpm --force --nodeps
5.安装完成之后查询版本:
mysqladmin --version
报错:
问题描述:mysqladmin: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory;启动时报错:
解决:尝试一些改软连接的方法都不好使,这里就不细说了,一下是我的解决方案,尝试有效;
在Linux中安装openssl10,进行OpenSSL升级(用yum升不上去,用rpm包简单有效),
具体操作:
1、下载rpm包
2、安装rpm包
rpm -i compat-openssl10-1.0.2o-3.el8.x86_64.rpm
完美解决!
?6.初始化mysql:
mysqld --initialize //创建数据文件目录和mysql系统数据库 产生随机root密码
7.启动mysql服务:
systemctl start mysqld
报错:
[root@localhost mysql8.0]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
报错原因:启动失败,因为/var/lib/mysql目录权限不够
解决方法:授权:chown -R mysql:mysql /var/lib/mysql/
8.启动服务:
systemctl start mysqld?
9.查看mysql服务:
ps -ef | grep mysql
10.查看初始化随机生成的root密码:
[root@localhost mysql8.0]# cat /var/log/mysqld.log | grep password
2020-05-22T14:59:39.740017Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: won-V%kYc1al
11.安全设置: mysql_secure_installation
[root@localhost mysql8.0]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: //输入上面查到的临时密码 won-V%kYc1al
The existing password for the user account root has expired. Please set a new password.
New password: // 输入新密码 root1mysql@
Re-enter new password: // 输入新密码 root1mysql@
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: 0
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) : No //是否需要修改root用户密码
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) : No //继续使用提供的密码
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) : No // 是否禁止root远程连接
... 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!
12.Mysql登录:
mysql -uroot -p? ?
密码上面修改的
13.如何停止、重启和查看mysql服务:
systemctl stop mysqld //停止服务
systemctl restart mysqld //重启服务
systemctl status mysqld //查看服务
14.设置外网连接
use mysql;? ? //指定数据库
alter user 'root'@'localhost' identified by 'root';? //修改密码
update user set host = '%' where user = 'root';? ?//修改Host
flush privileges;? ? //刷新权限
15.Mysql的相关安装目录文件:
?/usr/bin? ? ? ? //相关命令
/etc/my.cnf? ? ?//mysql的启动配置文件
/var/lib/mysql? //数据库文件存放目录
/usr/share/mysql-8.0/ //配置文件目录
参考作品:
CentOS8 安装 MySQL8.0(RPM)
内容总结
以上是互联网集市为您收集整理的Linux(Centos 8.2) 使用RPM包安装Mysql8.0.20全部内容,希望文章能够帮你解决Linux(Centos 8.2) 使用RPM包安装Mysql8.0.20所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。