mysql常见问题集锦

登录时提示密码错误

# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

通过免密码登录的方式更改密码

在/etc/my.cnf文件的最后添加一行“skip-grant-tables”,修改完密码后,再把此行配置注释或删除

>update user  set password=password('1234qwer') where user='root';

mysql5.7需要用下面的SQL修改密码

>update user set authentication_string=password('1234qwer') where user='root';


克隆mysql做主从配置

show slave status \G;

             Slave_IO_Running: No
            Slave_SQL_Running: Yes

查看后台/var/log/mysqld.log

2017-11-29T03:45:58.264849Z 8 [Note] Error reading relay log event for channel '': slave SQL thread was killed
2017-11-29T03:46:43.051822Z 9 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2017-11-29T03:46:43.056257Z 9 [Note] Slave I/O thread for channel '': connected to master 'backup@192.168.1.106:3306',replication started in log 'FIRST' at position 4
2017-11-29T03:46:43.078007Z 10 [Warning] Slave SQL for channel '': If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0
2017-11-29T03:46:43.079075Z 10 [Note] Slave SQL thread for channel '' initialized, starting replication in log 'FIRST' at position 0, relay log './CentOS65M2-relay-bin.000001' position: 4
2017-11-29T03:46:43.089291Z 9 [ERROR] Slave I/O for channel '': Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work. Error_code: 1593
2017-11-29T03:46:43.089373Z 9 [Note] Slave I/O thread exiting for channel '', read up to log 'FIRST', position 4

在mysql中,重新生成一个uuid,

mysql>select uuid();

根据/etc/my.cnf的配置信息,datadir=/var/lib/mysql

找到/var/lib/mysql/auto.cnf,将其中server-uuid的值,用新生成的uuid代替,重启mysqld服务


参考:

http://blog.csdn.net/skywalker_leo/article/details/47274441

http://blog.csdn.net/better_space/article/details/53523353
/,r的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值