Mysql³£ÓÃÃüÁî½Å±¾
Mysql³£ÓÃÃüÁî½Å±¾
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÊÇ mysql -hÖ÷»ú -uÓû§Ãû -pÃØÃÜ
Àý×ÓÊÇ mysql -hlocalhost -uroot -p123456
Ҫȷ¶¨mysql°²×°Ê±ºò¹´Ñ¡ÁË¿ÉÒÔÔ¶³ÌÁ´½Ó¡£Èç¹ûµÇ½±¾µØ¼ÆËã»ú£¬-h¿ÉÒÔÊ¡ÂÔ£¬¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë123456£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË¡£
µÚÈýÕС¢Ôö¼ÓÐÂÓû§
Óï·¨ÊÇ grant ȨÏÞ on Êý¾Ý¿â.±í to Óû§Ãû@µÇ¼Ö÷»ú identified by “ÃÜÂë”
Àý×ÓÊÇ
ËùÓÐȨÏÞ grant all privalleges on zf.* to guqin@localhost identified by “123456″
selectȨÏÞ grant all select on zf.* to guqin@localhost identified by “123456″
µÚËÄÕС¢²Ù×÷Êý¾Ý¿â
µÇ¼µ½mysqlÖУ¬È»ºóÔÚmysqlµÄÌáʾ·ûÏÂÔËÐÐÏÂÁÐÃüÁÿ¸öÃüÁîÒԷֺŽáÊø¡£
1¡¢ ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
2¡¢ ÏÔʾ¿âÖеÄÊý¾Ý±í¡£
use mysql;
show tables;
3¡¢ ÏÔʾÊý¾Ý±íµÄ½á¹¹¡£
desc ±íÃ÷;
4¡¢ ½¨¿âÓëɾ¿â
create database ¿âÃû;
drop database ¿âÃû;
5¡¢ ½¨±íºÍɾ±í¡£
use ¿âÃû;
create table ±íÃû(×Ö¶ÎÁбí);
drop table ±íÃû;
6¡¢ Çå¿Õ±íÖмǼ¡£
delete from ±íÃû;
7¡¢ ÏÔʾ±íÖеļǼ¡£
select * from ±íÃû;
µÚÎåÕС¢µ¼³öºÍµ¼ÈëÊý¾Ý
1. µ¼³öÊý¾Ý¡£
Óï·¨ÊÇ mysqldump –opt ¿âÃû.±íÃû > c:\data.sql
Àý×ÓÊÇ mysqldump -hlocalhost -uroot -p123456 zf.user>c:\data.sql
2. µ¼ÈëÊý¾Ý:
Óï·¨ÊÇ mysqldump –opt ¿âÃû < c:\data.sql
Àý×ÓÊÇ mysqldump -hlocalhost -uroot -p123456 zf<c:\data.sql
»òÕß
mysqlimport -hlocalhost -u root -p123456 < c:\data.sql
3. ½«Îı¾Êý¾Ýµ¼ÈëÊý¾Ý¿â:
use ¿âÃû;
load data local infile “ÎļþÃû” into table ±íÃû;
µÚÁùÕÐ ´´½¨Ò»¸öÊý¾Ý¿â±í
CREATE TABLE MYTABLE (name VARCHAR(20), sex CHAR(1));
µÚÆßÕÐ Íù±íÖмÓÈë¼Ç¼
insert into ±íÃû values (”1″,”2″);
µÚ°ËÕÐ ÓÃÎı¾·½Ê½½«Êý¾Ý×°ÈëÊý¾Ý¿â±íÖÐ
LOAD DATA LOCAL INFILE “c:/data.sql” INTO TABLE ±íÃû;
µÚ¾ÅÕÐ µ¼Èë.sqlÎļþÃüÁÀýÈçc:/data.sql£©
use database;
source c:/data.sql
µÚÊ®ÕÐ ¸üбíÖÐÊý¾Ý
update MYTABLE set sex=”f” where name=’hyq’;
µÚʮһÕÐ ÐÞ¸´±í
repair ±íÃû
Ïà¹ØÎĵµ£º
ÓÅ»¯MySQL·þÎñÆ÷µÄÅäÖòÎÊý£¬¿ÉÒÔÌá¸ßMySQLÊý¾Ý¿âµÄÐÔÄÜ£¬µ«ÊǶÔÓÚÅäÖýϵ͵ķþÎñÆ÷À´Ëµ£¬ÄãÎÞÂÛÔõôÓÅ»¯ÅäÖ㬶¼²»»áµÃµ½ÀíÏëµÄЧ¹û£¬ÄǾÍÖ»ÄÜÌá¸ßÄãÓ²¼þÅäÖã¬À´³¹µ×ÓÐЧµØ¸ÄÉÆ·þÎñÆ÷µÄÐÔÄÜ¡£
¾ßÌåµÄ·½·¨ÈçÏ£º
Ò»¡¢ÔÚÉèÖÃMySQL ʱ£¬Ó¦¸ÃÅäÖÃÆäʹÓþ²Ì¬¿â¶ø²»Êǹ²Ïí¿â¡£Ê¹Óù²Ïí¿âµÄ¶¯Ì¬¶þ½øÖÆϵͳ¿É½ÚÊ¡´ÅÅ̿ռ䣬µ«¾² ......
LinuxÏÂmysqlµÄ°²×°²½Ö裨·Çrpm°²×°£©
1 ÏÂÔØmysql-standard-5.0.27-linux-i686-glibc23.tar.gz °ü
2 ½âѹµ½°²×°Ä¿Â¼£º tar -zxvf /edass/db/mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
3 ½« mysql-standard-5.0.27-linux-i686-glibc23Á´½Óµ½mysql : ln –s mysql-standard-5.0.27-linux-i686 ......
ÕâÀ½éÉÜÒ»ÏÂCentOSÏÂMySQLÊý¾Ý¿â·þÎñÆ÷µÄ¹¹½¨·½·¨¡£
°²×°MySQL¼°Ïà¹Ø×é¼þ
¡¡¡¡Ê×ÏÈ£¬°²×°MySQL¡£
[root@sample ~]#
yum
-y install mysql-server
¡¡ ← °²×°MySQL
Setting up Install Process
Setting up repositories
dag 100% |=========================| 1.1 kB 00:00
update ......
Ê×ÏÈ·ÅÖúÃjdbcÇý¶¯³ÌÐò£¬ÔÚ java\jre6\lib\ext\Ï£¬java\jdk1.6\jre\libµÈµØ·½¶¼·ÅÆðÀ´£¬ÒòΪ²»È·¶¨ÔÚÄÄÀïÓÐÓ÷··
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost/DATABASENAME?user=USERNAME&password=PASSWORD&useUnicode=tru ......
ÓÉÓÚ×î½üÒ»Ö±ÔÚÁ˽âmysql¡£¸÷ÖÖ±íÀàÐ͵ÄÊý¾Ý´æ´¢ÒÔ¼°Ïà¹ØÏÞÖƾÍÊDZØÐëÁ˽âµÄ·½ÃæÁË¡£
×Ô¼ºµÄ·þÎñÆ÷»·¾³£ºOS Cent OS ext3£¬memory 4G£¬ disk 2T block size 4K¡£
¾µ÷²é£¬linuxÏÂÎļþ×î´óÊÇ´æÔÚÏÞÖƵġ£È¥googleÉÏËÑÁËËÑ£¬´ó¼Ò˵·¨²»Ò»£¬×îÖÕ×Ô¼º»¹ÊÇÕÒµ½±È½Ï¹Ù·½µÄ˵¡£Ïê¼ûhttp://en.wikipedia.org/wiki/Ext3 ËùÒÔ× ......