1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 1、rpm安装
- wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
-
- rpm -ivh mysql57-community-release-el7-9.noarch.rpm
-
- yum install mysql-community-server
-
- 安装如下:
- mysql-community-libs x86_64 5.7.17-1.el7 mysql57-community 2.1 M
- mysql-community-libs-compat x86_64 5.7.17-1.el7 mysql57-community 2.0 M
- mysql-community-server x86_64 5.7.17-1.el7 mysql57-community 162 M
- mysql-community-client x86_64 5.7.17-1.el7 mysql57-community 24 M
- mysql-community-common x86_64 5.7.17-1.el7 mysql57-community 271 k
- 2、systemctl启动mysql
- systemctl start mysqld
- systemctl status mysqld
- 3、systemctl设置开机启动
- systemctl enable mysqld
- systemctl daemon-reload
- 3、修改mysql root密码
- grep 'temporary password' /var/log/mysqld.log
- ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypasswd';
- 创建新用户并授权
- CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypasswd';
- 配置文件:/etc/my.cnf
- 日志文件:/var/log/mysqld.log
- 服务启动脚本:/usr/lib/systemd/system/mysqld.service
- socket文件:/var/run/mysqld/mysqld.pid
- 主从:
- Master:
- flush tables with read lock;
- show master status;
- unlock tables;
- stop slave;
- change master to master_host='172.21.250.165',master_user='buyao',master_password='buyao#!#303132MYSQLbuyao',master_log_file='binlog.000004',master_log_pos=1947;
- show slave status;
- start slave;
-
|