MYSQL 问题php
(1)mysql server has gone awayhtml
导数据时,若是脚本太大,会执行中断,这时须要修改最大容许包的大小:mysql
set global max_allowed_packet=1024*1024*16;sql
(2)函数数据库
a.建立app
delimiter $$ CREATE DEFINER=`yun_aged_test2`@`%` FUNCTION `GetDistrictName1`(`DistrictID` int) RETURNS varchar(255) CHARSET utf8 BEGIN DECLARE DistrictName varchar(255) DEFAULT ''; SELECT area_name into DistrictName from sys_area WHERE area_id = DistrictID; RETURN DistrictName; END $$
b.显示全部函数ide
show function status;
c.查看定义函数
show create function GetDistrictName;
(3)远程拷贝的本地Mysql的储存过程,报错:[Err] 1449 - The user specified as a definer ('admin_isbox'@'localhost') does not existui
凭借之前常常见到的root@localhost报错,给root赋值全部权限:url
grant all privileges on *.* to root@"%" identified by ".";
flush privileges;
发现无效。
可能数据库没有此用户:
select user,host from mysql.user;
没找到此用户,可是报错出现了这个用户。寻求谷歌后,找到解决方法:
SELECT definer,type FROM mysql.proc GROUP BY definer,type;
UPDATE mysql.proc SET definer='root@localhost' WHERE definer = '*username*@localhost';
重启数据库,OK