常用MYSQL命令
啟動:net start mySql;
進(jìn)入:mysql -u root -p/mysql -h localhost -u root -p databaseName;
列出數(shù)據(jù)庫:show databases;
選擇數(shù)據(jù)庫:use databaseName;
列出表格:show tables;
創(chuàng)建數(shù)據(jù)表:mysql> CREATE TABLE mytable (name VARCHAR(20), sex CHAR(1),
-> birth DATE, birthaddr VARCHAR(20));
顯示表格列的屬性:show columns from tableName;
修改表的結(jié)構(gòu):DESCRIBE mytable;
建立數(shù)據(jù)庫:source fileName.txt;
匹配字符:可以用通配符_代表任何一個字符,%代表任何字符串;
增加一個字段:alter table tabelName add column fieldName dateType;
增加多個字段:alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType;
多行命令輸入:注意不能將單詞斷開;當(dāng)插入或更改數(shù)據(jù)時,不能將字段的字符串展開到多行里,否則硬回車將被儲存到數(shù)據(jù)中;
增加一個管理員帳戶:grant all on *.* to user@localhost identified by "password";
每條語句輸入完畢后要在末尾填加分號’;’,或者填加’\g’也可以;
查詢時間:select now( );
查詢當(dāng)前用戶:select user( );
查詢數(shù)據(jù)庫版本:select version( );
查詢當(dāng)前使用的數(shù)據(jù)庫:select database( );
2015年全國職稱計算機考試教材(2007模 .. 定價:¥225 優(yōu)惠價:¥213 更多書籍 | |
全國職稱計算機考試速成過關(guān)系列套裝:W .. 定價:¥133 優(yōu)惠價:¥133.0 更多書籍 |