linux: 银河麒麟v10安装mysql8

一,准备依赖环境

# yum install perl
# yum install net-tools
# yum install libaio-devel
# yum install numactl-devel

二,下载mysql源并安装

# wget https://dev.mysql.com/get/mysql80-community-release-el8-3.noarch.rpm

安装mysql源:

# rpm -ivh mysql80-community-release-el8-3.noarch.rpm

三,yum安装mysql

安装:

# yum install -y mysql-community-server --nogpgcheck

配置启动:

# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
# systemctl start mysqld.service
# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2026-04-24 16:43:05 CST; 3s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 202363 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 202436 (mysqld)
   Status: "Server is operational"
    Tasks: 38
   Memory: 492.8M
   CGroup: /system.slice/mysqld.service
           └─202436 /usr/sbin/mysqld

Apr 24 16:42:54 ecm-qykwz-1-0002 systemd[1]: Starting MySQL Server...
Apr 24 16:43:05 ecm-qykwz-1-0002 systemd[1]: Started MySQL Server.

配置自启动:

# systemctl enable mysqld.service
# systemctl is-enabled mysqld.service
enabled

四,配置mysql账号:

1,得到临时密码

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

2,用临时密码登录到mysql,修改密码并创建新账号

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.46

Copyright (c) 2000, 2026, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码';
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE USER 'root'@'%' IDENTIFIED BY '你的新密码';
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

3,重启mysql

# systemctl restart mysqld.service
# systemctl status mysqld.service  

五,测试效果

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.46 MySQL Community Server - GPL

Copyright (c) 2000, 2026, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

 

posted @ 2026-04-25 07:12  刘宏缔的架构森林  阅读(3)  评论(0)    收藏  举报