栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Mac m1 Ubuntu里docker中安装mysql

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Mac m1 Ubuntu里docker中安装mysql

大数据技术AI

Flink/Spark/Hadoop/数仓,数据分析、面试,源码解读等干货学习资料

117篇原创内容

公众号

0、环境
  • mac m1

  • 虚拟机pd+Ubuntu(arm64)

  • Mysql 5.8

1、问题

m1 直接docker pull mysql 报:

MacBook-Pro ~ % docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
no matching manifest for linux/arm64/v8 in the manifest list entries

Docker Hub上没有适用于arm64架构的mysql镜像。

M1芯片是arm64架构,也称作aarch64架构,只能运行arm64/aarch64架构的程序。

所以ubuntu也是arm64架构,才能装上。

为啥不装centos,因为实在装不上。

2、使用:docker pull mysql/mysql-server:latest

3、查看镜像

4、启动镜像登录mysql

5、配置 5.1 总体配置
 mysql> use mysql;
 Database changed
 mysql> show databases;
 +--------------------+
 | Database           |
 +--------------------+
 | information_schema |
 | mysql              |
 | performance_schema |
 | sys                |
 +--------------------+
 4 rows in set (0.01 sec)
 
 mysql> use mysql;
 Database changed
 mysql> select host,user from user;
 +-----------+------------------+
 | host      | user             |
 +-----------+------------------+
 | localhost | healthchecker    |
 | localhost | mysql.infoschema |
 | localhost | mysql.session    |
 | localhost | mysql.sys        |
 | localhost | root             |
 +-----------+------------------+
 5 rows in set (0.00 sec)
 
 mysql> update mysql.user set host='%' where user='root';
 Query OK, 1 row affected (0.00 sec)
 Rows matched: 1  Changed: 1  Warnings: 0
 
 mysql> select host,user from user;
 +-----------+------------------+
 | host      | user             |
 +-----------+------------------+
 | %         | root             |
 | localhost | healthchecker    |
 | localhost | mysql.infoschema |
 | localhost | mysql.session    |
 | localhost | mysql.sys        |
 +-----------+------------------+
 5 rows in set (0.00 sec)
 
 mysql>  flush privileges;
 Query OK, 0 rows affected (0.01 sec)
5.2 修改密码

mysql5.8前修改密码:

 mysql> UPDATE user SET Password = password ( '123456' ) WHERe User = 'root';
 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( 'a123456' ) WHERe User = 'root'' at line 1
 mysql>  flush privileges;
 Query OK, 0 rows affected (0.01 sec)

mysql5.8后修改密码:

查看版本

 bash-4.4# mysql -uroot -p
 Enter password:
 Welcome to the MySQL monitor.  Commands end with ; or g.
 Your MySQL connection id is 166
 Server version: 8.0.28 MySQL Community Server - GPL
 
 Copyright (c) 2000, 2022, 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> update user set authentication_string=password('123456') where user='root';
 Query OK, 1 row affected (0.01 sec)
 Rows matched: 1  Changed: 1  Warnings: 0

方式二:

 mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
 Query OK, 0 rows affected (0.01 sec)
6、宿主机连接

7、mac用datagrip连接

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/941486.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号