MySQLµÄ°²×°£¨Ãâ°²×°°æ±¾£©
Ò»¡¢ÏÂÔØMySQL
¹Ù·½ÍøÕ¾£ºwww.mysql.org
¶þ¡¢°²×°
1.½«´ËѹËõ°ü½âѹËõµ½Öƶ¨Îļþ¼ÐÏ£¬ÒÔ"C:/mysql"ΪÀý
2.½«my-midium.ini¸´ÖÆÒ»·Ý£¬²¢ÖØÃüÃûΪmy.ini
3.½«C:/mysql/bin/libmysql.dll¸´ÖƵ½ÏµÍ³Ä¿Â¼Ï£¬ÀýÈ縴ÖƵ½"C:/windows"ÏÂ
4.ÔÚÃüÁîÐÐģʽÏ£¬ÔËÐÐC:/mysql/bin/mysqld£¬¼´¿É¿ªÆôMySQL·þÎñÆ÷µÄÊØ»¤¹ý³Ì£¬Èç¹û¹Ø±Õ£¬¿É½øÈëC:/mysql/binÏ£¬ÊäÈ룺
mysql admin -u root -p shutdown(rootÓÐÃÜÂë)
mysql admin -u root shutdown(rootÎÞÃÜÂë)
ÐÞ¸ÄrootÃÜÂ룺
£¨Ò»£©Ã»ÃÜÂëʱ
1.¿ªÆôÊØ»¤½ø³Ì£¬¼´ÔËÐÐ"C:/mysql/bin/mysql"
2.ÔÚÃüÁîÐÐģʽÏ£¬½øÈë"C:/mysql/bin"Ŀ¼£¬ÊäÈ룺mysqladmin -u root password 'your password'
ÆäÖÐ'your password'ΪÄãÒªÉ趨µÄÃÜÂë
£¨¶þ£©ÓÐÃÜÂëʱ
1.ÔÚÃüÁîÐÐģʽÏ£¬½øÈë"C:/mysql/bin"Ŀ¼£¬ÊäÈ루¿ªÆôÊØ»¤½ø³Ì£©£ºmysqld --skip -grant -tables
2.ÊäÈ룺mysql ½øÈëmysqlÃüÁîÐУ¬Ìáʾ·ûΪ"mysql>"
3.ÊäÈ룺
use mysql
update user set password=''
where user='root' and host='local host';
exit
4.ÊäÈë mysqladmin -uroot password 'your password'£¬ÉèÖÃÄúµÄÃÜÂë
Ïà¹ØÎĵµ£º
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMySQLÒ²¾ÍÍê³ÉÁË¡£Ä¬ÈϵÄÓû§ÃûÊÇroot£¬ÃÜÂë ......
Ò»¡¢mysql·þÎñ²Ù×÷
1¡¢net start mysql //Æô¶¯mysql·þÎñ
2¡¢net stop mysql //Í£Ö¹mysql·þÎñ¡¡
3¡¢mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë //½øÈëmysqlÊý¾Ý¿â
4¡¢quit //Í˳ömysql²Ù×÷
5¡¢mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë //¸ü¸ÄÃÜÂë
6¡¢grant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identifie ......
#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field;
......
MysqlÊý¾Ý¿âÌṩÁ½ÖÖÀàÐ͵ÄË÷Òý£¬Èç¹ûûÕýÈ·ÉèÖã¬Ë÷ÒýµÄÀûÓÃЧÂÊ»á´ó´òÕÛ¿ÛÈ´ÍêÈ«²»ÖªÎÊÌâ³öÔÚÕâ¡£
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
ÒÔÉÏ´ ......