readme.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 1、rpm安装
  2. wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
  3. rpm -ivh mysql57-community-release-el7-9.noarch.rpm
  4. yum install mysql-community-server
  5. 安装如下:
  6. mysql-community-libs x86_64 5.7.17-1.el7 mysql57-community 2.1 M
  7. mysql-community-libs-compat x86_64 5.7.17-1.el7 mysql57-community 2.0 M
  8. mysql-community-server x86_64 5.7.17-1.el7 mysql57-community 162 M
  9. mysql-community-client x86_64 5.7.17-1.el7 mysql57-community 24 M
  10. mysql-community-common x86_64 5.7.17-1.el7 mysql57-community 271 k
  11. 2、systemctl启动mysql
  12. systemctl start mysqld
  13. systemctl status mysqld
  14. 3、systemctl设置开机启动
  15. systemctl enable mysqld
  16. systemctl daemon-reload
  17. 3、修改mysql root密码
  18. grep 'temporary password' /var/log/mysqld.log
  19. ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypasswd';
  20. 创建新用户并授权
  21. CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypasswd';
  22. 配置文件:/etc/my.cnf
  23. 日志文件:/var/log/mysqld.log
  24. 服务启动脚本:/usr/lib/systemd/system/mysqld.service
  25. socket文件:/var/run/mysqld/mysqld.pid
  26. 主从:
  27. Master:
  28. flush tables with read lock;
  29. show master status;
  30. unlock tables;
  31. stop slave;
  32. 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;
  33. show slave status;
  34. start slave;