ÎÒÃǵÄÏîÄ¿ÖÐÓкö಻µÈÓÚµÄÇé¿ö¡£½ñÌìдÕâƪÎÄÕ¼òµ¥µÄ·ÖÎöÒ»ÏÂÔõô¸öÓÅ»¯·¨¡£
ÕâÀïµÄ·Ö±íÂß¼ÊǸù¾Ýt_group±íµÄuser_name×éµÄ¸öÊýÀ´·ÖµÄ¡£
ÒòΪÕâÖÖÇé¿öµ¥¶Àuser_name×Ö¶ÎÉϵÄË÷Òý¾ÍÊôÓÚÀÃË÷Òý¡£Æð²»ÁËɶÃûÃ÷ÏÔµÄЧ¹û¡£
1¡¢ÊÔÑéPROCEDURE.
DELIMITER $$
DROP PROCEDURE `t_girl`.`sp_split_table`$$
CREATE PROCEDURE `t_girl`.`sp_split_table`()
BEGIN
declare done int default 0;
declare v_user_name varchar(20) default '';
declare v_table_name varchar(64) default '';
-- Get all users' name.
declare cur1 cursor for select user_name from t_group group by user_name;
-- Deal with error or warnings.
declare continue handler for 1329 set done = 1;
-- Open cursor.
open cur1;
while done <> 1
do
fetch cur1 into v_user_name;
if not done then
-- Get table name.
set v_table_name = concat('t_group_',v_user_name);
-- Create new extra table.
&nbs ......
MYSQL ÐÞ¸ÄrootÃÜÂëÃüÁî
cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin
Ç°Ì᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
ÊäÈë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë update user set password=password('ÐÂÃÜÂë') where user='root';
»ØÏÔ
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> ״̬ÏÂÊäÈë FLUSH PRIVILEGES;
»ØÏÔ
Query OK, 0 rows affected (0.00 sec)
mysql> ״̬ÏÂÊäÈë quit
Í˳ö sql
×¢Òâÿ¸öÃüÁîºó¶¼Òª¼ÓÉÏÒ»¸ö·ÖºÅ ";"
mysql ²Å¿ªÊ¼Ö´ÐиÃÐÐÃüÁî
¶øµÚ¶þ¸öÖ¸Áî»áÈÃÒÑÔØÈë¼ÇÒäÌåµÄ mysql ϵͳ×ÊÁÏ¿â¸üÐÂ
ÖØÆð mysql .
ÔÚ¸üРroot ÃÜÂëáᣬÈÕááÒªÓë MySQL Á¬Ïߵķ½·¨Îª£º
mysql -uroot -pÐÂÃÜÂë
==================================================
Íü¼Çmysql µÄroot ÃÜÂ룺
ÏÈÈ·ÈÏÒѾɱµômysqld ½ø³ÌÁË£¬È»ºóÖ´ÐÐÕâ¸ö
/usr/bin/safe_mysqld --skip-grant-tables &
ÔÙÕâÑùµÇ¼
mysql -h 192.168.1.2 -u root
ÉϱߵÄ192.168.1.2 ÊÇcloud µÄmysqld ÔËÐлúÆ÷£¬Äã»»³É×Ô¼ºµÄ£¬ÕâÑùµÇ¼ÉÏ
È¥£¬¾Í¿ÉÒÔÐÞ¸ÄÃÜÂëÁË¡£
ÐÞ¸ÄÃÜÂë
1.mysql -h hostname –u root ÃüÁ ......
ÎÊ£ºÈç¹ûÍü¼ÇÁËMySQLµÄrootÃÜÂëÓ¦µ±ÈçºÎÈ¡»Ø£¿
´ð£º½â¾ö·½·¨ÈçÏ£º
·¨1£ºÔÚmy.cnfµÄ[mysqld]×ֶμÓÈ룺
skip-grant-tables
È»ºóÖØÆôÄãµÄmysqld,ÕâÑù¾ÃûÓÐÃÜÂëÁË.
È»ºó½øÈëmysql¡£
UPDATE mysql.user SET Password=PASSWORD
('password') WHERE User='root';
³É¹¦ºó
FLUSH PRIVILEGES;
×îºóÈ¥µômy.cnfÖеÄskip-grant-tables
ÖØÆômysqld¡£
·¨2£º./bin/mysqld_safe --skip-grant-tables --user=root ......
ÒÔÏÂÊÇÍêÕûµÄÀý×Ó¡£
1¡¢Ð½¨±í
#title: ×Ô¶¨Òå×Ö·û
#auther: Сǿ(Õ¼²·Ê¦)
#date:
2008
-
01
-08
drop
table
if
exists
Category;
create
table
Category
(
cateId
int
(
5
)
not
null
AUTO_INCREMENT,
chiName
varchar
(
80
),
primary
key
(cateId)
);
drop
table
if
exists
OpenRecord;
create
table
OpenRecord
(
opreI ......
Error Code : 1418
This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
(0 ms taken)
·ÖÎö£º
¸ù¾ÝϵͳÌáʾ£¬µ¼Ö¸ôíÎóµÄÔÒò¿ÉÄÜÊÇÒ»¸ö°²È«ÉèÖ÷½ÃæµÄÅäÖ㬲éÊÖ²álog_bin_trust_function_creators²ÎÊýȱʡ0£¬ÊDz»ÔÊÐífunctionµÄͬ²½µÄ£¬Ò»°ãÎÒÃÇÔÚÅäÖÃrepliactionµÄʱºò£¬¶¼Íü¼Ç¹Ø×¢Õâ¸ö²ÎÊý£¬ÕâÑùÔÚmaster¸üÐÂfuntionºó£¬slave¾Í»á±¨¸æ´íÎó£¬È»ºóslave stoped¡£
´¦Àí¹ý³Ì£º
µÇ½mysqlÊý¾Ý¿â
> set global log_bin_trust_function_creators £½ 1;
> start slave;
¸ú×ÙmysqlµÄÆô¶¯ÈÕÖ¾£¬slaveÕý³£ÔËÐУ¬ÎÊÌâ½â¾ö¡£ ......
а²×°ºóµÄmysqlÊý¾Ý¿â£¬ÆäĬÈϵÄ×î´óÁ¬½ÓÊýΪ100¡£
·½·¨Ò»£º
ÔÚmysql°²×°Â·¾¶Ï£¬ÕÒµ½my.ini»òÕßmy.cnfÎļþ£¬´ò¿ªËüÕÒµ½max_connections,ÉèÖóÉ1000; È»ºóÖØÆômysql·þÎñ¡£
·½·¨¶þ£º
ÔÚmysqlÔËÐл·¾³Ï£¬½øÈëmysqlÃüÁîÏ£º
mysql> set global max_connections=1000;
È»ºó¹Ø±ÕmysqlÖØÆôËü£»
ÔÚ./bin·¾¶Ï£¬Ê¹Óà # ./mysqladmin -uroot -p123456 variables | grep "max_connections"
¿´µ½ | max_connections | 1000 |
˵Ã÷ÐÂÐ޸ĵÄÁ¬½ÓÊýÒѾÉúЧÁË¡£
Ò²¿ÉÒÔÔÚmysqlÔËÐл·¾³Ï£¬Ö´ÐУºmysql> show variables; ²é¿´max_connectionsµÄÖµ¡£
Ò²¿ÉÒÔÔÚmysqlÔËÐл·¾³Ï£¬Ö´ÐУºmysql> show status; ²é¿´µ±Ç°»î¶¯µÄÁ¬½ÓÏß³ÌÖµ£¬¼´ÕÒµ½threads_connectedµÄÖµ¾ÍÊÇÁË¡£
·½·¨Èý£º
±à¼mysqld_safeÎļþ£º # vi /usr/local/mysql/bin/mysqld_safe
ÕÒµ½msyqldÆô¶¯µÄÄÇÁ½ÐУ¬ÔÚºóÃæ¼ÓÉϲÎÊý£º
-O max_connections=1500
È»ºóÖØÐÂÆô¶¯mysql·þÎñ£¬¾ÍOKÁË¡£ ......