MySQL³£ÓòÙ×÷»ù±¾²Ù×÷
¹Ø¼ü×Ö: mysql³£ÓòÙ×÷»ù±¾²Ù×÷
MySQL³£ÓòÙ×÷»ù±¾²Ù×÷£¬ÒÔ϶¼ÊÇMySQL5.0ϲâÊÔͨ¹ýÊ×ÏÈ˵Ã÷Ï£¬¼ÇסÔÚÿ¸öÃüÁî½áÊøʱ¼ÓÉÏ£»£¨·ÖºÅ£©
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p --default-character-set=latin1 Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû(Êý¾Ý¿âĬÈϱàÂëÊÇlatin1)
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
mysqldump -u wcnc -p -d –add-drop-table smgp_apps_wcnc >d:wcnc_db.sql
-d ûÓÐÊý¾Ý –add-drop-table ÔÚÿ¸öcreateÓï¾ä֮ǰÔö¼ÓÒ»¸ödrop table
4.µ¼ÈëÊý¾Ý¿â
³£ÓÃsource ÃüÁî
½øÈëmysqlÊý¾Ý¿â¿ØÖÆ̨£¬
Èçmysql -u root -p
mysql>use Êý¾Ý¿â
È»ºóʹÓÃsourceÃüÁºóÃæ²ÎÊýΪ½Å±¾Îļþ(ÈçÕâÀïÓõ½µÄ.sql)
mysql>source d:wcnc_db.sql
Ò»¡¢Æô¶¯ÓëÍ˳ö
1¡¢½øÈëMySQL£ºÆô¶¯MySQL Command Line Client£¨MySQLµÄDOS½çÃ棩£¬Ö±½ÓÊäÈ밲װʱµÄÃÜÂë¼´¿É¡£´ËʱµÄÌáʾ·ûÊÇ£ºmysql>
2¡¢Í˳öMySQL£ºquit»òexit
¶þ¡¢¿â²Ù×÷
1¡¢¡¢´´½¨Êý¾Ý¿â
ÃüÁcreate database <Êý¾Ý¿âÃû>
ÀýÈ磺½¨Á¢Ò»¸öÃûΪxhkdbµÄÊý¾Ý¿â
mysql> create database xhkdb;
2¡¢ÏÔʾËùÓеÄÊý¾Ý¿â
ÃüÁshow databases £¨×¢Ò⣺×îºóÓиös£©
mysql> show databases;
3¡¢É¾³ýÊý¾Ý¿â
ÃüÁdrop database <Êý¾Ý¿âÃû>
ÀýÈ磺ɾ³ýÃûΪ xhkdbµÄÊý¾Ý¿â
mysql> drop database xhkdb;
4¡¢Á¬½ÓÊý¾Ý¿â
ÃüÁ use <Êý¾Ý¿âÃû>
ÀýÈ磺Èç¹ûxhkdbÊý¾Ý¿â´æÔÚ£¬³¢ÊÔ´æÈ¡Ëü£º
mysql> use xhkdb;
ÆÁÄ»Ìáʾ£ºDatabase changed
5¡¢µ±Ç°Ñ¡Ôñ£¨Á¬½Ó£©µÄÊý¾Ý¿â
mysql> select database();
6¡¢µ±Ç°Êý¾Ý¿â°üº¬µÄ±íÐÅÏ¢£º
mysql> show tables; £¨×¢Ò⣺×îºóÓиös£©
Èý¡¢±í²Ù×÷£¬²Ù×÷֮ǰӦÁ¬½Óij¸öÊý¾Ý¿â
1¡¢½¨±í
ÃüÁcreate table <±íÃû> ( <×Ö¶ÎÃû1> <ÀàÐÍ1> [,..<×Ö¶ÎÃûn> <ÀàÐÍn>]);
mysql> create table MyClass(
> id int(4) not null primary key auto_increment,
> name char(20) not null,
> sex int(4) not null default '0',
> degree double(16,2));
2¡¢»ñÈ¡±í½á¹¹
ÃüÁ desc ±íÃû£¬»òÕßshow columns from ±íÃû
mysql>DESCRIBE MyClass
mysql&g
Ïà¹ØÎĵµ£º
ÔÚ±íÖÐÒÑÓдóÁ¿µÄindexµÄÇé¿öϲåÈë´óÁ¿Êý¾Ý£¬¿ÉÒÔ²ÉÓÃÏȽ«Ë÷Òýɾ³ý£¬È»ºóÔÙ²åÈëÊý¾Ý£¬È»ºóÔÙÖØн¨Á¢Ë÷Òý¡£Ö®ËùÒÔÕâÑù»á¿ìÊÇÒòΪ£¿£¿£¿
7.2.14 Speed of INSERT Statements
The time to insert a record is determined by the following factors, where the numbers indicate approximate proportions:
& ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......
ÐÂʹÓÃMySQL£¬ËµÆðÀ´ÊǸö¼òµ¥µÄÊÂÇ飬µ«ÊÇÈ´·ÑÁËЩÖÜÕÛ£º
1¡¢µÇ½·þÎñÆ÷¶Ë£¬½øÈëÃüÁîÐУ¬windows cmd;
2¡¢ÉèÖÃÓû§¡¢ÃÜÂëÈÃÖ¸¶¨µÄIP·ÃÎÊ£ºmysql -u root -p »ò°²×°µÄ¿ì½Ý·½Ê½½øÈë:MySQL Command Line Client,ʹÓÃgrantÃüÁ
grant ȨÏÞ1,ȨÏÞ2,…ȨÏÞn on Êý¾Ý¿âÃû³Æ.±íÃû³Æ to Óû§Ãû@Óû§µØÖ· identified ......
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <mysql.h>
#pragma comment(lib,"libmysql")
int _tmain(int argc, _TCHAR* argv[])
{
MYSQL* mysql;
MYSQL_RES* results;
MYSQL_ROW record;
mysql = mysql_init(NULL);
if(! ......