Mysql 8 rpm安装

下载地址
https://downloads.mysql.com/archives/community/
Mysql 8 rpm安装_第1张图片

解压
tar -xvf mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar

-rw-r--r--. 1 root root  859453440 Dec 13 06:58 mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415  14709160 Jul  7 01:00 mysql-community-client-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415   2632376 Jul  7 01:00 mysql-community-client-plugins-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415    660264 Jul  7 01:00 mysql-community-common-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 481580308 Jul  7 01:01 mysql-community-debuginfo-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415   1958588 Jul  7 01:01 mysql-community-devel-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415   4217604 Jul  7 01:01 mysql-community-embedded-compat-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415   2218720 Jul  7 01:01 mysql-community-icu-data-files-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415   1582228 Jul  7 01:01 mysql-community-libs-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415    685808 Jul  7 01:02 mysql-community-libs-compat-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415  56195524 Jul  7 01:02 mysql-community-server-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415  21350292 Jul  7 01:02 mysql-community-server-debug-8.0.30-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 271649024 Jul  7 01:04 mysql-community-test-8.0.30-1.el7.x86_64.rpm

rpm -ivh 解释

i  install安装
v 提示
h 显示进度条

依次安装下面的包

rpm -ivh mysql-community-common-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.30-1.el7.x86_64.rpm

过程中遇到的问题

1)warning: mysql-community-libs-8.0.30-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
        mariadb-libs is obsoleted by mysql-community-libs-8.0.30-1.el7.x86_64
卸载原来的依赖
 yum remove mysql-libs

(2)warning: mysql-community-server-8.0.30-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
        mysql-community-icu-data-files = 8.0.30-1.el7 is needed by mysql-community-server-8.0.30-1.el7.x86_64
安装icu-data-files
rpm -ivh mysql-community-icu-data-files-8.0.30-1.el7.x86_64.rpm

产看版本、是否安装成功

[root@localhost opt]# mysqladmin --version
mysqladmin  Ver 8.0.30 for Linux on x86_64 (MySQL Community Server - GPL)

[root@localhost opt]# rpm -qa|grep -i mysql
mysql-community-client-plugins-8.0.30-1.el7.x86_64
mysql-community-icu-data-files-8.0.30-1.el7.x86_64
mysql-community-libs-8.0.30-1.el7.x86_64
mysql-community-common-8.0.30-1.el7.x86_64
mysql-community-server-8.0.30-1.el7.x86_64
mysql-community-client-8.0.30-1.el7.x86_64

初始化

mysqld --initialize --user=mysql

启停

启动:systemctl start mysqld.service
重启:systemctl restart mysqld.service
查看状态:systemctl status mysqld.service

获取密码

cat var/log/mysqld.log

登陆、改密码、附权限

登陆
mysql -hlocalhost -P3306 -uroot -p
改密码
ALTER user 'root'@'localhost'IDENTIFIED WITH mysql_native_password BY 'asd@123';
改访问权限
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'asd@123';
附权限
grant all privileges on *.* to 'root'@'%';
刷新
flush privileges;

你可能感兴趣的:(mysql,mysql,数据库,linux)