MySQL 出错案例
1.mysql配置文件修sql-mode或sql_mode为NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
请在mysql配置文件修改sql_mode或sql-mode
解决方法
mysql中修改my.cnf
找到sql_mode
修改值为 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
如果没有该字段
在[mysqld]标签里新增
sql_mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
重启mysql
原因Mysql还有一个模式控制这个 就是NO_AUTO_CREATE_USER模式
以前给mysql服务器添加用户:
grant CREATE, DROP,INSERT, SELECT, DELETE, UPDATE,ALTER on xxx.* to xxx;
grant CREATE, DROP,INSERT, SELECT, DELETE, UPDATE,ALTER on xxx.* to xxx@localhost;
set password for xxx@'%' = password(xxx);
set password for xxx@'localhost' = password(xxx);
flush privileges;
Mysql服务器抱错
Can't find any matching row in the user table
Mysql还有一个模式控制这个 就是NO_AUTO_CREATE_USER模式
在mysql客户端中运行
mysql> set sql_mode = 'no_auto_create_user';
不能成功 原因是没有提供用户密码
解决的办法是添加一个indentified 子句
grant CREATE, DROP,INSERT, SELECT, DELETE, UPDATE,ALTER on xxx.* to xxx identified by 'xxx';
空密码是不认的
grant CREATE, DROP,INSERT, SELECT, DELETE, UPDATE,ALTER on xxx.* to xxx identified by ''; 就不行。
千年的回眸
MySQL导入报错
syntax to use near ‘json DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET
MySQL导入报错:
check the manual that corresponds to your MySQL server version for the right syntax to use near ‘json DEFAULT NULL,PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4’ at line 3
原因MySQL版本从5.7版本之后开始支持JSON数据类型sql包从较高版本导出后在将其导入较低版本 从5.7版本导出 然后导入5.6版本
解决方法方法一 将mysql升级到5.7及以上版本升
方法二 将sql文件中的json全部替换成longtext重新导入即可
千年的回眸
参考地址
千年的回眸
0.0.0.0:3306: bind: address already in use
docker启动mysql报错
Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use
问题描述
Error response from daemon: driver failed programming external connectivity on endpoint mysql (11c5baee97c46d1f911f0ab48f5ee59b918dd27954102d40177997cba255962f): Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use
linux的3306端口被占用了
解决方法
查看当前占用端口 netstat -tanlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 13252/docker-proxy
杀死进程 kill 13252 占用端口进程的
kill 13252
就可以成功启动docker的mysql镜像了
千年的回眸
参考地址