标签:unity roo local variable 改密码 emc alter for log
如果防火墙有屏蔽,先安装rz
yum install lrzsz -y
再在本地下载,再上传 https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
安装的过程如果和mariadb包有冲突,如果要有先卸载
rpm -qa|grep mariadb
查看已安装的mariadb包
rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64 rpm -e --nodeps mariadb-5.5.44-2.el7.centos.x86_64 rpm -e --nodeps mariadb-devel-5.5.44-2.el7.centos.x86_64
依次先后安装
rpm -ivh mysql/mysql-community-common-5.7.20-1.el7.x86_64.rpm rpm -ivh mysql/mysql-community-libs-5.7.20-1.el7.x86_64.rpm rpm -ivh mysql/mysql-community-client-5.7.20-1.el7.x86_64.rpm rpm -ivh mysql/mysql-community-server-5.7.20-1.el7.x86_64.rpm
[mysqld] character-set-server=utf8 [mysql] default-character-set = utf8 [mysql.server] default-character-set = utf8 [mysqld_safe] default-character-set = utf8 [client] default-character-set = utf8
查看修改后的效果
SHOW VARIABLES LIKE ‘character%‘;
mysqld --initialize --user=mysql 如有必要指定路径可以加上下面的参数 --basedir=/usr/local/mysql --datadir=/data/mysql
root 用户随机密码保留在/var/log/mysqld.log 文件中
systemctl start mysqld (启动mysql)
systemctl restart mysqld (重启mysql)
systemctl status mysqld (查看状态)
mysql -u root -p (使用刚才的随机密码)
或者 使用下面命令初始化mysql,则不需要密码登录
mysqld --initialize-insecure --user=mysql mysql -u root --skip-password alter user ‘root‘@‘localhost‘ identified by ‘pwd456‘;
如果无法登录,再修改/etc/my.cnf 文件 加入以下参数
skip-grant-tables
再 systemctl restart mysqld (重启mysql) 就可以无密码登录了,修改密码
update user set authentication_string=password("pwd456") where user="root"; flush privileges;
log-bin=mysql-bin server-id=1 --------下面可以忽略 binlog-ignore-db=information_schema binlog-ignore-db=mysql -----------------------
GRANT FILE ON *.* TO replicate@‘xx.xx.xx.xx‘ IDENTIFIED BY ‘pwd123‘; GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO replicate@‘xx.xx.xx.xx‘ IDENTIFIED BY ‘pwd123‘; 查看状态 SHOW MASTER STATUS \G;
log-bin=mysql-bin (非必须项,当slave需要同步的时候才必须) server-id=2 log_slave_updates = 1 read_only = 1 slave-skip-errors = all slave-net-timeout = 60 --------下面可以忽略 binlog-ignore-db=information_schema binlog-ignore-db=cluster binlog-ignore-db=mysql replicate-do-db=ufind_db replicate-ignore-db=mysql
change master to master_host=‘xx.xx.xx.01‘,master_user=‘replicate‘,master_password=‘pwd123‘,master_log_file=‘mysql-bin.000001‘, master_log_pos=760;
查看 slave 状态
START SLAVE;
SHOW SLAVE STATUS \G;
可以看到
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
参考
mysql的安装 参考 https://jingyan.baidu.com/article/93f9803f010d8fe0e56f555e.html
标签:unity roo local variable 改密码 emc alter for log
原文地址:https://www.cnblogs.com/tommyjiang/p/10714440.html