您的位置:首页 > 数据库 > MySQL

mysql常见问题集锦

2017-11-29 11:29 253 查看

登录时提示密码错误

# 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的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  密码