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