华为欧拉OpenEuler(Linux)安装MySQL8.0

Euler版本:openEuler-22.03-LTS-x86_64-dvd.iso

1、下载MySQL

下载地址:

https://dev.mysql.com/downloads/mysql/8.0.html

下载对应的版本,其中Euler 22.03 对应CentOS8,CentOS8 == Red Hat Enterprise Linux 8(el8)

 

 

2、上传安装文件

再利用xftp工具将上述下载的.rpm文件上传到服务器的刚创建的文件夹中

 

 

3、安装文件

安装依赖包

1、net-tools(1-mysql-community-server-8.0.30-1.el8.x86_64.rpm 依赖  net-tools)

 

安装MySQL文件,依次安装

1、rpm -ivh 1-mysql-community-common-8.0.30-1.el8.x86_64.rpm

2、rpm -ivh 1-mysql-community-client-plugins-8.0.30-1.el8.x86_64.rpm

3、rpm -ivh 1-mysql-community-libs-8.0.30-1.el8.x86_64.rpm

4、rpm -ivh 1-mysql-community-client-8.0.30-1.el8.x86_64.rpm

5、rpm -ivh 1-mysql-community-icu-data-files-8.0.30-1.el8.x86_64.rpm

6、rpm -ivh 1-mysql-community-server-8.0.30-1.el8.x86_64.rpm

4、配置MySql

1、初始化mysql    

# mysqld --initialize --user=mysql

2、设置mysql服务自启动

# systemctl enable mysqld
# systemctl start mysqld

3、查看默认密码

#sudo grep 'temporary password' /var/log/mysqld.log

(默认密码 loaclhost: 后面的部分,:后有一个空格,不是密码里的)

 

 

 

4、修改默认密码

Mysql 8.0 需要先修改默认密码,才能执行sql。否则报错如下:

 

 

 ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; //记得修改自己的账户

5、设置远程访问权限

create user 'root'@'%' identified by 'dbu12345';

grant all privileges on *.* to 'root'@'%';

flush privileges;

posted @ 2022-11-15 18:24  二两也逍遥  阅读(6087)  评论(0编辑  收藏  举报