pucasoft_JDBC_t01_Êý¾Ý¿âmysql²Ù×÷
²Ù×÷Êý¾Ý¿â
µÇ¼µ½mysqlÖУ¬È»ºóÔÚmysqlµÄÌáʾ·ûÏÂÔËÐÐÏÂÁÐÃüÁÿ¸öÃüÁîÒԷֺŽáÊø¡£
1¡¢ ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
ȱʡÓÐÁ½¸öÊý¾Ý¿â£ºmysqlºÍtest¡£ mysql¿â´æ·Å×ÅmysqlµÄϵͳºÍÓû§È¨ÏÞÐÅÏ¢£¬ÎÒÃǸÄÃÜÂëºÍÐÂÔöÓû§£¬Êµ¼ÊÉϾÍÊǶÔÕâ¸ö¿â½øÐвÙ×÷¡£
2¡¢ ÏÔʾ¿âÖеÄÊý¾Ý±í£º
use mysql;
show tables;
3¡¢ ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
4¡¢ ½¨¿âÓëɾ¿â£º
create database ¿âÃû;
drop database ¿âÃû;
5¡¢ ½¨±í£º
use ¿âÃû;
create table ±íÃû(×Ö¶ÎÁбí);
drop table ±íÃû;
6¡¢ Çå¿Õ±íÖмǼ£º
delete from ±íÃû;
7¡¢ ÏÔʾ±íÖеļǼ£º
select * from ±íÃû;
µÚÎåÕС¢µ¼³öºÍµ¼ÈëÊý¾Ý
1. µ¼³öÊý¾Ý£º
mysqldump --opt test > mysql.test
¼´½«Êý¾Ý¿âtestÊý¾Ý¿âµ¼³öµ½mysql.testÎļþ£¬ºóÕßÊÇÒ»¸öÎı¾Îļþ
È磺mysqldump -u root -p123456 --databases dbname > mysql.dbname
¾ÍÊÇ°ÑÊý¾Ý¿âdbnameµ¼³öµ½Îļþmysql.dbnameÖС£
2. µ¼ÈëÊý¾Ý:
mysqlimport -u root -p123456 < mysql.dbname¡£
²»ÓýâÊÍÁË°É¡£
3. ½«Îı¾Êý¾Ýµ¼ÈëÊý¾Ý¿â:
Îı¾Êý¾ÝµÄ×Ö¶ÎÊý¾ÝÖ®¼äÓÃtab¼ü¸ô¿ª¡£
use test;
load data local infile "ÎļþÃû" into table ±íÃû;
1:ʹÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
mysql> SHOW DATABASES;
2: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"
Ïà¹ØÎĵµ£º
1. ÔÚʹÓÃNavicat 8 for MySQL¿Í»§¶Ë´´½¨Êý¾Ý¿âʱ£¬±àÂëµÄÉèÖÃÈçÏÂͼ£º
2. ½«°²×°Ä¿Â¼F:\MySQL\MySQL Server 5.1Ï£¬my.iniÎļþÉèÖñäÁ¿Öµdefault-character-set=gbk £¨°üº¬Á½´¦£¬¿É²éÕÒdefault-character-set£©£¬È»ºóÖØÆôMYSQL·þÎñ¡£ ......
Ò»Ö±ÒÔΪmysqlËæ»ú²éѯ¼¸ÌõÊý¾Ý£¬¾ÍÓÃ
SELECT * from `table` ORDER BY RAND() LIMIT 5
¾Í¿ÉÒÔÁË¡£
µ«ÊÇÕæÕý²âÊÔһϲŷ¢ÏÖÕâÑùЧÂʷdz£µÍ¡£Ò»¸ö15ÍòÓàÌõµÄ¿â£¬²éѯ5ÌõÊý¾Ý£¬¾ÓȻҪ8ÃëÒÔÉÏ
²é¿´¹Ù·½ÊֲᣬҲ˵rand()·ÅÔÚORDER BY ×Ó¾äÖлᱻִÐжà´Î£¬×ÔȻЧÂʼ°ºÜµÍ¡£
You cannot use a column with RAND() values i ......
¡¡¡¡ÒÔMySQL-server-4.0.14-0.i386.rpmΪÀý£¬·ÅÔÚ/dataĿ¼ÏÂ
¡¡¡¡cd /data
¡¡¡¡rpm -ivh MySQL-server-4.0.14-0.i386.rpm
¡¡¡¡°²×°Íê³ÉºóÔÚ/usr/share/mysqlĿ¼ÖлáÓÐÒ»¸ömysqlµÄÆô¶¯½Å±¾mysql.server¼°Ê¾ÀýÅäÖÃÎļþµÈ(Èçmy-huge.cnf¡¢my-large.cnf¡¢my-medium.cnf)
¡¡¡¡¿½±´Ò»¸öʾÀýÅäÖÃÎ ......
1.ʲô½Ð×ö×Ö·û¼¯
×Ö·û¼¯¾ÍÊÇÒ»Ì×·ûºÅºÍ×Ö·û±àÂëµÄ¼¯ºÏ¡£
2.ʲô½Ð×öУ¶Ô¹æÔò
У¶Ô¹æÔò¾ÍÊÇÔÚ×Ö·û¼¯ÄÚÓÃÓڱȽÏ×Ö·ûµÄÒ»Ì×¹æÔò¡£
MYSQL5.1Êý¾Ý¿â¿ÉÒÔ×öµ½
· ʹÓöàÖÖ×Ö·û¼¯À´´æ´¢×Ö·û´®
· ʹÓöàÖÖУ¶Ô¹æÔòÀ´±È½Ï×Ö·û´®
· ÔÚͬһ̨·þÎñÆ÷¡¢Í¬Ò»¸öÊý¾Ý¿â»òÉõ ......
×öÈí¼þÊý¾Ý¿â±Ø²»¿ÉÉÙ£¬ÎÒÑ¡ÔñÁËMySQL¡£
Ê×Ïȵ½http://dev.mysql.com/downloads/ÏÂÔغÃMySQL5.1ºÍMySQL GUI TOOLS
ϵ½µçÄÔÉÏ,È»ºó°²×°£¬ÏÈ×°5.1ÔÙ×°gui tools ,һ·ȷ¶¨°É¡£
ŪºÃºó£¬µã¿ªMySQL Query Browser£¬¾Í¿ÉÒÔ²Ù×÷Êý¾Ý¿âÁË¡£
MySQLµÄÇý¶¯³ÌÐòÊÇGUITOOLS°²×°Ä¿Â¼/java/libϵÄmysql-connector-java-5.0.4-bin.ja ......