MySql´´½¨º¯Êý
Ê×ÏÈÐèÒª²é¿´Ò»Ï´´½¨º¯ÊýµÄ¹¦ÄÜÊÇ·ñ¿ªÆô£º
X:\proper\mysql\bin>mysql -h localhost -u root -p
Enter password: **********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 5.0.22-community-nt-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like '%func%';
+-----------------------------------------+-------+
| Variable_name | Value |
+-----------------------------------------+-------+
| log_bin_trust_function_creators | ON |
+-----------------------------------------+-------+
1 row in set (0.02 sec)
Èç¹ûValue´¦ÖµÎªOFF£¬ÔòÐ轫Æä¿ªÆô¡£
mysql> set global log_bin_trust_function_creators=1;
´´½¨º¯Êýʱ£¬ÏÈÑ¡ÔñÊý¾Ý¿â£¬
mysql> use xxx;
Database changed
delimiter $$ÊÇÉèÖà $$ΪÃüÁîÖÕÖ¹·ûºÅ£¬´úÌæ·ÖºÅ£¬ÒòΪ·ÖºÅÔÚbegin...endÖлáÓõ½£»
mysql> delimiter $$
mysql> create function test(t varchar(255))
-> returns varchar(255)
-> begin
-> return left(t,1);
-> end
-> $$
Query OK, 0 rows affected (0.13 sec)
º¯Êý´´½¨³É¹¦ºóÐè»Ö¸´·ÖºÅΪÃüÁîÖÕÖ¹·ûºÅ¡£
mysql> delimiter ;
²âÊÔ£º
mysql> select test('alpha');
+----------------+
| test('alpha') |
+---------------+
| a |
+---------------+
1 row in set (0.02 sec)
ɾ³ýº¯Êý£º
mysql> drop function test;
Query OK, 0 rows affected (0.11 sec)
Ïà¹ØÎĵµ£º
Ò»¡¢ ·ÖÇøµÄ¸ÅÄî
¶þ¡¢ ΪʲôʹÓ÷ÖÇø£¿£¨Óŵ㣩
Èý¡¢ ·ÖÇøÀàÐÍ
ËÄ¡¢ ×Ó·ÖÇø
Îå¡¢ ¶Ô·ÖÇø½øÐÐÐ޸ģ¨Ôö¼Ó¡¢É¾³ý¡¢·Ö½â¡¢ ......
MySqlÊý¾Ý¿âµ¼³öcsvÎļþÃüÁ
mysql> select first_name,last_name,email from account into outfile 'e:\\output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '\n';
csvÎļþЧ¹û£º
sunny
Grigoryan
lovechoosesun@gmail.com
Jon
Siegal
sun@riliantech.net
Joe
S ......
1¡¢±à¼MySQLÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini¡¡//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf
ÔÚ[MySQLd]ÅäÖöÎÌí¼ÓÈçÏÂÒ»ÐУº
skip-grant-tables
±£´æÍ˳ö±à¼¡£
2¡¢È»ºóÖØÆôMySQL·þÎñ
windows»·¾³ÖУº
net stop MySQL
net start MySQL
linux»·¾³ÖÐ ......
MySQL client programs:
mysql
The command-line tool for interactively entering SQL statements or executing them from a file in batch mode. See Section 4.5.1, “mysql — The MySQL Command-Line Tool”.
mysqladmin
A client that performs administrative operations, such as crea ......
ÐÞ¸Ä /etc/mysql/my.cnf Îļþ£¬
ÔÚ £Ûclient£Ý ϼÓÈë default-character-set=utf8,
ÔÚ [mysqld] ϼÓÈë default-character-set=utf8,
ÔòÔÚviÀï¿ÉÒÔÕýÈ·µÄÏÔʾÖÐÎÄÁË£¨Ç°ÌáÊÇviҲʹÓÃutf8£©¡£
²»¹ýÔÚ²éѯµÄʱºò£¬½á¹ûÀïµÄÖÐÎÄÈ´»áÏÔʾ³É "?"£¬Õâ¸öÎÊÌâ±È½Ï¼òµ¥µÄ·½·¨Óм¸ÖÖ£¬·Ö±ðÊÇ£º
1.ÔÚ´´½¨Ê ......