停止mysql命令:sudo /etc/inint.d/mysql stop
重启mysql命令:sudo /etc/inint.d/mysql restart
1.在mysql的user表里创建一个用户 方法一:insert into user(Host,User,Password) values("localhost","liuyuantao","root");若报如下错误:ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value 原因:mysql5.1以上版本,mysql用户表的中某些字段不能为空,没有默认值,其实是操作错误,mysql添加用户是不能这样直接insert user表的。
正确做法:GRANT USAGE ON *.* TO 'lyt'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
用户:lyt,密码:123456,这样就添加了一个新的用户,不会出以上的错误了。
刷新下权限:flush privileges;2.建立连接使用navicat创建远程连接:错误一:2003-Can`t connect to MySQL server on '192.168.16.98'(10038)原因:mysql的服务器不允许远程连接。解决方案:sudo cim /etc/mysql/my.conf找到并修改bind-address = 127.0.0.1改为bind-address = 0.0.0.0执行sudo /etc/init.d/mysql restart重启即可错误二:1045-Access denied for user 'lyt'@'192.168.61.201'(using password:YES)查看下现在lyt用户的Host,原来Host还是localhost,只需要更改为%即可。执行如下命令:update user set host="%" where user = "lyt" and host ="localhost";刷新下权限:flush privileges;
再次连接成功