当前位置:   article > 正文

MySQL中遇到的ERROR以及解决办法_mysql error

mysql error

1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA错误

这是我们开启了bin-log, 我们就必须指定我们的函数是否是
1 DETERMINISTIC 确定性的
2 NO SQL 没有SQl语句,当然也不会修改数据
3 READS SQL DATA 只是读取数据,当然也不会修改数据
4 MODIFIES SQL DATA 要修改数据
5 CONTAINS SQL 包含了SQL语句

在这里插入图片描述

其中在function里面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。如果我们开启了 bin-log, 我们就必须为我们的function指定一个参数。

在MySQL中创建函数时出现这种错误的解决方法:

set global log_bin_trust_function_creators=TRUE;
  • 1

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

远程登录mysql遇到的问题

登陆mysql

mysql -u root -p
  • 1

出现错误,提示 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

一般只要修改密码就可以解决。

下面就是如何重置密码。
1.关闭mysql

service mysql stop
  • 1

2 .修改my.cnf配置文件
打开mysql配置文件, 一般是/etc/my.cnf文件,在文件末尾添加

 skip-grant-tables
  • 1

现在就可以无密码登陆mysql了

3.登陆mysql并重置密码

service mysqld start
mysql -u root


# 重置密码
mysql> update mysql.user set authentication_string=password('新密码') 
where user='root'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

4.修改配置文件并重启mysql
打开配置文件my.cnf并将刚才添加的skip-grant-tables注释掉,并重启mysql,就可以用刚才设置的密码登陆了

service mysqld restart
  • 1

ERROR 1018 (HY000): Can’t read dir of ‘./test/’ (errno: 13 - Permission denied)

ERROR 1018 (HY000): Can't read dir of './test/' (errno: 13 - Permission denied)
mysql> select * from t_hero;
ERROR 1017 (HY000): Can't find file: './test/t_hero.frm' (errno: 13 - Permission denied)
mysql> create table users(id int,pwd int);
ERROR 1005 (HY000): Can't create table 'users' (errno: 13)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

出现问题的原因是没有权限读取

1.先查看 /etc/my.conf配置,查看data目录在哪里,给目录添加对应的权限即可。

vim /etc/my.conf
  • 1

在这里插入图片描述

chown -R mysql:mysql data
chmod -R 755 data/

  • 1
  • 2
  • 3

我遇到的情况data目录是属于mysql
在这里插入图片描述
因为是数据库不能访问有没有可能是数据库文件的权限被更改了,我们看看data目录下的数据库文件的权限
在这里插入图片描述
果然test数据库的权限被改为了root
下面我们把权限修改为mysql问题就解决了

chown -R mysql:mysql test
chmod -R 755 test/
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/743949
推荐阅读
相关标签
  

闽ICP备14008679号