1.show databases; (展示數(shù)據(jù)庫(kù),注意分號(hào)和s)
2.use mysql;(使用某個(gè)數(shù)據(jù)庫(kù))
3.select user,host,password from user;
4.show tables;(展示表格)
在linux下 安裝mysql
5.登錄mysql: mysql -uroot -proot
6.desc tabels;(查看表屬性)
7.刪除某個(gè)表:drop table tablename;
8.退出mysql:exit;
9.重啟mysql:/etc/init.d/mysql restart
10.為數(shù)據(jù)庫(kù)授權(quán)
? ? GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
注釋:'myuser'@'192.168.1.3' ? ?ip是自己的電腦 myuser自定義一個(gè)訪問(wèn)該數(shù)據(jù)庫(kù)的賬戶名崇摄,mypassword是這個(gè)賬號(hào)訪問(wèn)數(shù)據(jù)庫(kù)的密碼聚凹。
myuser mypassword是可以隨意起的呵恢,只需要在自己的電腦上能正確輸入密碼即可
FLUSH? PRIVILEGES;
11.查看指定表的建表語(yǔ)句
show create table? tablename \G
\G是格式化打印