- 准备两台centos主机(这里两台主机IP为192.168.2.11和192.168.2.12)
- 到mysql官网下载mysql5.7 bundle
mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar - 解压mysql5.7
包含10个文件
mysql-community-client-5.7.37-1.el7.x86_64.rpm
mysql-community-common-5.7.37-1.el7.x86_64.rpm
mysql-community-devel-5.7.37-1.el7.x86_64.rpm
mysql-community-embedded-5.7.37-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.37-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.37-1.el7.x86_64.rpm
mysql-community-libs-5.7.37-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm
mysql-community-server-5.7.37-1.el7.x86_64.rpm
mysql-community-test-5.7.37-1.el7.x86_64.rpm - 删除mariadb
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64 - 安装
rpm -ivh *.rpm - 查看mysql-server安装的文件列表
rpm -ql mysql-community-server-5.7.37 - 查看默认密码
cat /var/log/mysqld.log |grep password[root@slave1 mysql57]# cat /var/log/mysqld.log |grep password 2022-02-03T09:59:22.090885Z 1 [Note] A temporary password is generated for root@localhost: AJDtlg*kM1W1
- 关闭validate_password插件
vim /etc/my.cnf最后添加validate_password=OFF# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid validate_password=OFF #新添加
-
登录mysql
mysql -uroot -p回车输入/var/log/mysqld.log中的密码 -
设置密码(需要关闭密码验证插件validate_password=OFF)
set password for root@localhost=password('123456'); -
查看mysql现有账号
use mysql;
mysql> select user,host from user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
3 rows in set (0.00 sec) -
添加远程账号
mysql> grant all privileges on *.* to root@'%' identified by 'admin888';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) -
centos添加3306端口
[root@slave1 mysql57]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@slave1 mysql57]# firewall-cmd --reload
success
相关文章
- 09-12pip自动生成和安装requirements.txt
- 09-12mac 安装laravel Valet环境
- 09-12tableau desktop 安装步骤
- 09-12数据分析——Tableau安装与破解
- 09-12学习大数据BI分析工具tableau第一期(tableau简介和安装)
- 09-12TerraGate软件安装后,不能启动的解决办法
- 09-12Mac 10.12下安装python3环境
- 09-12安装Tensorflow过程pip安装报错:is not a supported wheel on this platform
- 09-12使用pip安装报错的处理方法
- 09-12Python——pip安装报错:is not a supported wheel on this platform