MySql³£ÓÃÃüÁî
MySql³£ÓÃÃüÁî
¡¾MySqlÃüÁî´°¿ÚÆô¶¯£ºÇëÖ´ÐÐ\bin\mysql.exe¡¿
1:ʹÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
mysql> SHOW DATABASES;
2:´´½¨Ò»¸öÊý¾Ý¿âMYSQLDATA
mysql> CREATE DATABASE MYSQLDATA;
3:Ñ¡ÔñÄãËù´´½¨µÄÊý¾Ý¿â
mysql> USE MYSQLDATA; (°´»Ø³µ¼ü³öÏÖDatabase changed ʱ˵Ã÷²Ù×÷³É¹¦£¡)
4:²é¿´ÏÖÔÚµÄÊý¾Ý¿âÖдæÔÚʲô±í
mysql> SHOW TABLES;
5:´´½¨Ò»¸öÊý¾Ý¿â±í
mysql> CREATE TABLE MYTABLE (name VARCHAR(20), sex CHAR(1));
6:ÏÔʾ±íµÄ½á¹¹£º
mysql> DESCRIBE MYTABLE;
7:Íù±íÖмÓÈë¼Ç¼
mysql> insert into MYTABLE values (”hyq”,”M”);
8:ÓÃÎı¾·½Ê½½«Êý¾Ý×°ÈëÊý¾Ý¿â±íÖУ¨ÀýÈçD:/mysql.txt£©
mysql> LOAD DATA LOCAL INFILE “D:/mysql.txt” INTO TABLE MYTABLE;
9:µ¼Èë.sqlÎļþÃüÁÀýÈçD:/mysql.sql£©
mysql>use database;
mysql>source d:/mysql.sql;
10:ɾ³ý±í
mysql>drop TABLE MYTABLE;
11:Çå¿Õ±í
mysql>delete from MYTABLE;
12:¸üбíÖÐÊý¾Ý
mysql>update MYTABLE set sex=”f” where name=’hyq’;
¡¾ÒÔÏÂÊÇÎÞÒâÖÐÔÚÍøÂç¿´µ½µÄʹÓÃMySqlµÄ¹ÜÀíÐĵá¿
ÔÚwindowsÖÐMySqlÒÔ·þÎñÐÎʽ´æÔÚ£¬ÔÚʹÓÃǰӦȷ±£´Ë·þÎñÒѾÆô¶¯£¬Î´Æô¶¯¿ÉÓÃnet start mysqlÃüÁîÆô¶¯¡£¶øLinuxÖÐÆô¶¯Ê±¿ÉÓÓ/etc/rc.d/init.d/mysqld start”ÃüÁעÒâÆô¶¯ÕßÓ¦¾ßÓйÜÀíԱȨÏÞ¡£
¸Õ°²×°ºÃµÄMySql°üº¬Ò»¸öº¬¿ÕÃÜÂëµÄrootÕÊ»§ºÍÒ»¸öÄäÃûÕÊ»§£¬ÕâÊǺܴóµÄ°²È«Òþ»¼£¬¶ÔÓÚһЩÖØÒªµÄÓ¦ÓÃÎÒÃÇÓ¦½«°²È«ÐÔ¾¡¿ÉÄÜÌá¸ß£¬ÔÚÕâÀïÓ¦°ÑÄäÃûÕÊ»§É¾³ý¡¢ rootÕÊ»§ÉèÖÃÃÜÂ룬¿ÉÓÃÈçÏÂÃüÁî½øÐУº
use mysql;
delete from User where User=”";
update User set Password=PASSWORD(’newpassword’) where User=’root’;
Èç¹ûÒª¶ÔÓû§ËùÓõĵǼÖն˽øÐÐÏÞÖÆ£¬¿ÉÒÔ¸üÐÂUser±íÖÐÏàÓ¦Óû§µÄHost×ֶΣ¬ÔÚ½øÐÐÁËÒÔÉϸü¸ÄºóÓ¦ÖØÐÂÆô¶¯Êý¾Ý¿â·þÎñ£¬´ËʱµÇ¼ʱ¿ÉÓÃÈçÏÂÀàËÆÃüÁ
mysql -uroot -p;
mysql -uroot -pnewpassword;
mysql mydb -uroot -p;
mysql mydb -uroot -pnewpassword;
ÉÏÃæÃüÁî²ÎÊýÊdz£ÓòÎÊýµÄÒ»²¿·Ö£¬ÏêϸÇé¿ö¿É²Î¿¼Îĵµ¡£´Ë´¦µÄmydbÊÇÒªµÇ¼µÄÊý¾Ý¿âµÄÃû³Æ¡£
ÔÚ ½øÐпª·¢ºÍʵ¼ÊÓ¦ÓÃÖУ¬Óû§²»Ó¦¸ÃÖ»ÓÃrootÓû§½øÐÐÁ¬½ÓÊý¾Ý¿â£¬ËäȻʹÓÃrootÓû§½øÐвâÊÔÊ
Ïà¹ØÎĵµ£º
²âÊÔ»·¾³£ºmysql 5.0.45 ¡¾×¢£º¿ÉÒÔÔÚmysqlÖÐͨ¹ýmysql> SELECT VERSION();À´²é¿´Êý¾Ý¿â°æ±¾¡¿ÕûÀí£ºWebjx.Com Ò»¡¢Á¬½ÓMYSQL¡£¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë 1¡¢Á¬½Óµ½±¾»úÉϵÄMYSQL¡£Ê×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§ÃûÇ°¿ÉÒÔÓпոñ ......
Timestamp·Òë¹ýÀ´Ò²½Ð“ʱ¼ä´Á”£¬¿ÉÒÔ°üº¬“Äê-ÔÂ-ÈÕ-ʱ-·Ö-Ãë-ºÁÃ딣¬ÊÇjava.util.DateϵÄÒ»¸ö×ÓÀà¡£Èç¹ûÏëʵÏÖÏòMysqlÖвåÈë´øÓÐʱ·ÖÃëµÄʱ¼ä£¬ÔÚ±í½á¹¹ÀïÐèÒªÖ¸¶¨×Ö¶ÎÀàÐÍΪDateTime£¬Java³ÌÐòÀïÔÚ»ñȡϵͳʱ¼äºóÐèҪת»»ÎªÊ±·ÖÃëµÄ¸ñʽ£¬ÔÙת»»ÎªTimestamp¼´¿É£¬ÈçÏÂËùʾ£º
Date dt = new Dat ......
½ñÌ쿪¶àÒ»¸öÓ¦ÓÃÔÚ APP SERVER ÉÏ£¬±¨¸æÒ»¸ö´íÎó:
ERROR 1040 (00000): Too many connections
Õâµ¹ÊÇ´ÓÀ´Ã»Åöµ½¹ý£¬²»¹ýÔÚ console Ï¿ÉÒÔÓà root µÇ¼ £¨console ÏÂÓÃÆäËûÓû§Ò²²»¿ÉµÇ¼£¬Too many connections£©
mysql -uroot -p
mysql > show processlist;
...
ÕâÀïÁÐÁË100¸öÁ´½Ó£¡£¡ÆäÖÐÖ»ÓÐ2¸öÁ´½ÓÊÇQ ......
define("DB_SERVER","127.0.0.1");
define("DB_PORT",3306);
define("DB_CATALOG","uab");
define("DB_USERID","root");
define("DB_PASSWORD","");
$dsn="mysql:host=".DB_SERVER.";port=".DB_PORT.";dbname=".DB_CATALOG;
self::$__PDO=new PDO($dsn, DB_USERID, DB_PASSWORD);
//support long connection
self:: ......
¡¡Ëæ×ÅÏÖ´úÊý¾Ý¿â¿ÉÓÃÌØÕ÷¼¯µÄѸËÙÔö¼Ó£¬ºÜÄÑÇø·ÖÊëºÃÊ뻵¡£ÀýÈçOracleÀï¾ÍÓÐÐí¶àÄã¿ÉÄÜ´ÓÀ´¶¼²»ÐèÒªµÄ¸ß¼¶Êý¾Ý²Ö¿âÌØÕ÷¡£´ËÍâÒ²¿ÉÄÜÓÐһЩÆäËü²»¿É»òȱµÄÌØÕ÷±ÈÈçACIDÊÂÎñÌØÐÔ¡£ÎÒÃÇÀ´¿´Ò»¿´Ö÷ÒªµÄһЩÌØÕ÷£¬±ÈÈç´æ´¢¹ý³Ì£¬ÊÓͼ£¬¿ìÕÕ£¬±íÊý¾ÝÀàÐͺÍÊÂÎñµÈµÈ¡£Í¬Ê±ÎÒÃÇ·ÖÎöÒ»ÏÂPostgresql£¬MySQLºÍOracleÕ⼸¸öÊý¾Ý¿â£¬È»º ......