vlambda博客
学习文章列表

Power服务器成功安装MySQL


Power服务器成功安装MySQL数据库


云服务器基本信息

Power服务器成功安装MySQL


搜索mysql镜像

docker hub链接[1]

Power服务器成功安装MySQL

Power服务器成功安装MySQL


服务器拉取镜像

[root@admin-instance-test-8 ~]# docker pull liupeng0518/mysql:5.7-ppc64le
5.7-ppc64le: Pulling from liupeng0518/mysql
e190211f5678: Pull complete
2a1c155837a3: Pull complete
dad3ac108c0d: Pull complete
3d12a70b9347: Pull complete
c932d8ef8a19: Pull complete
e4f5a742e64b: Pull complete
d65b99d746b9: Pull complete
c9c4e6ed697c: Pull complete
ba741aa244ab: Pull complete
Digest: sha256:d18cafa848d0a6d0038e20fe7a69c8b425abe5bd13dd377a6e01a34b7838b743
Status: Downloaded newer image for liupeng0518/mysql:5.7-ppc64le
[root@admin-instance-test-8 ~]#

查看镜像列表

[root@admin-instance-test-8 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mariadb latest 01df808b9de2 2 weeks ago 426MB
liupeng0518/mysql 5.7-ppc64le 675034fb8fb4 6 months ago 448MB
ppc64le/tomcat latest 8259e86df6f9 13 months ago 492MB
[root@admin-instance-test-8 ~]#

开启防火墙,放通本地端口

systemctl start firewalld

防火墙放行端口

  1. 添加端口

firewall-cmd --zone=public --add-port=1521/tcp --permanent

  1. 刷新生效

firewall-cmd --reload

  1. 查看防火墙放行列表

firewall-cmd --list-all

关闭防火墙

systemctl stop firewalld

创建并启动mysql

[root@admin-instance-test-8 ~]# docker run --name mysql -p 1521:3306 -e MYSQL_ROOT_PASSWORD=Hxserver612 -v /root/data/docker-mysql/data:/var/lib/mysql -d liupeng0518/mysql:5.7-ppc64le
59a4ef47a3f792d6f80523b82bfe78c3733caeee295ffde2d59adb8f804c205e
[root@admin-instance-test-8 ~]#

查看容器进程

[root@admin-instance-test-8 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59a4ef47a3f7 liupeng0518/mysql:5.7-ppc64le "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 33060/tcp, 0.0.0.0:1521->3306/tcp mysql
c7c8fde039e8 mariadb:latest "docker-entrypoint.s…" 2 days ago Exited (0) 2 hours ago mariadb
4f6523ea609d ppc64le/tomcat:latest "catalina.sh run" 2 days ago Exited (143) About an hour ago tomcat
[root@admin-instance-test-8 ~]#

进入mysql容器

[root@admin-instance-test-8 ~]# docker exec -it mysql /bin/bash
root@59a4ef47a3f7:/#

进入mysql数据库

root@59a4ef47a3f7:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26-1+b1 (Debian)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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> GRANT ALL ON *.* TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql>

刷新权限

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

密码永不过期

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

mysql>

刷新权限

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

查看数据库

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

mysql>

用户权限

mysql> \s
--------------
mysql Ver 14.14 Distrib 5.7.26, for Linux (ppc64le) using EditLine wrapper

Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.26-1+b1 (Debian)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 3 min 42 sec

Threads: 1 Questions: 10 Slow queries: 0 Opens: 112 Flush tables: 1 Open tables: 105 Queries per second avg: 0.045
--------------

mysql>

退出mysql数据库

mysql> exit
Bye
root@59a4ef47a3f7:/#

退出mysql容器

root@59a4ef47a3f7:/# exit
exit
[root@admin-instance-test-8 ~]#

Navicat远程连接

ppc64le终于能跑mysql了

blog address:

Power服务器成功安装MySQL数据库[2]

Reference

[1]

docker hub链接: https://hub.docker.com/search?q=mysql&type=image&architecture=ppc64le

[2]

Power服务器成功安装MySQL数据库: https://blog.csdn.net/frdevolcqzyxynjds/article/details/106726246