错误一:mysql(mariadb): unknown variable ‘character_set_server=utf8’
在mariadb里面设置字符编码的时候,client和server还不太一样,下如下这样设置就可以了
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
错误二:MySQL ERROR 1005: Can’t create table (errno: 150)
1、外键的引用类型不一样,如主键是int外键是char
2、找不到主表中引用的列
3、主键和外键的字符编码不一致,也可能存储引擎不一样
错误三:The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
在导出数据到目录的时候会遇到上面的错误,具体的语句为:
SELECT * FROM ciika INTO OUTFILE '/tmp/ciika.txt';
可以修改my.ini或者直接导出到mysql的目录
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/ |
+---------------------------+
修改语句为:SELECT * FROM ciika INTO OUTFILE ‘/var/lib/mysql-files/ciika.txt’;
错误四:SQLyog连接数据库报错plugin caching_sha2_password could not be loaded
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限
上面三个都需要执行,亲测可用
错误五:mysql5.7无法绑定0.0.0.0,一直是127.0.0.1
原因是由于mysql5.7修改了配置的地址/etc/mysql/mysql.conf.d/
修改后重启,然后可以看到netstat -ntpl | grep 3306 就是正确的了
错误六:ERROR 1396 (HY000): CREATE USER failed for ‘root’@‘localhost’
创建用户CREATE USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;发现系统报错。
ROR 1396 (HY000): Operation CREATE USER failed for ‘root’@‘localhost’
猜测是之前账号信息清理不干净。重新drop之后。发现正常。
参考链接:
mysql常见错误 : http://ciika.com/page/34/
ERROR 1396 (HY000): CREATE USER failed for ‘root’@‘localhost’ : https://mp.weixin.qq.com/s/afIBom8zbxpRTO3E1IciXg