MySQL
>mysql -h localhost -u root -p
Enter password:
密碼變更
>mysqladmin -h localhost -u root --password password "NewPassword"
帳號權限管理
GRANT ALL PRIVILEGES ON *.* TO
user@localhost
IDENTIFIED BY "user123";
GRANT ALL PRIVILEGES ON db.* TO db
user@localhost
IDENTIFIED BY "dbuser123";
REVOKE ALL PRIVILEGES ON db.* FROM db
user@localhost
IDENTIFIED BY "user123";
基本SQL指令
建立資料庫
mysql>create database db;
mysql>show databases;
mysql>drop database db;
資料庫選用
mysql>use db;
mysql>select database();
c:> mysql db -h localhost -u root -p
目前狀態
mysql>select user(), version(), database(), now();
建立表格
mysql>create table testTable ( ID int NOT NULL Primary key, name char(10));
mysql>show tables;
mysql>desc testTable;
匯入資料
mysql>mysql db -h localhost -u root -p < c:\
create_zip.sql;
mysql>mysql db -h localhost -u root -p < c:\
insert_zip.sql;