大数据技术AI
Flink/Spark/Hadoop/数仓,数据分析、面试,源码解读等干货学习资料
117篇原创内容
公众号
0、环境-
mac m1
-
虚拟机pd+Ubuntu(arm64)
-
Mysql 5.8
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连接



