赞
踩
这是我们开启了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;
远程登录mysql遇到的问题
登陆mysql
mysql -u root -p
出现错误,提示 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
一般只要修改密码就可以解决。
下面就是如何重置密码。
1.关闭mysql
service mysql stop
2 .修改my.cnf配置文件
打开mysql配置文件, 一般是/etc/my.cnf文件,在文件末尾添加
skip-grant-tables
现在就可以无密码登陆mysql了
3.登陆mysql并重置密码
service mysqld start
mysql -u root
# 重置密码
mysql> update mysql.user set authentication_string=password('新密码')
where user='root'
4.修改配置文件并重启mysql
打开配置文件my.cnf并将刚才添加的skip-grant-tables注释掉,并重启mysql,就可以用刚才设置的密码登陆了
service mysqld restart
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.先查看 /etc/my.conf配置,查看data目录在哪里,给目录添加对应的权限即可。
vim /etc/my.conf
chown -R mysql:mysql data
chmod -R 755 data/
我遇到的情况data目录是属于mysql
因为是数据库不能访问有没有可能是数据库文件的权限被更改了,我们看看data目录下的数据库文件的权限
果然test数据库的权限被改为了root
下面我们把权限修改为mysql问题就解决了
chown -R mysql:mysql test
chmod -R 755 test/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。