2008年9月23日 星期二

Debian----資料庫mysql

@MySQL-server
啟動檔 #/etc/init.d/mysql start(restart)
設定檔 #vi /etc/mysql/my.cnf
資料庫的操作
進入mysql
#mysql

mysql>show databases; --顯示資料庫
mysql>create database fcu; --建立 fcu這個資料庫
mysql>drop database fcu; --移除 fcu這個資料庫
mysql>exit --離開
mysql>\? --help
(\?) Synonym for `help'.clear
(\c) Clear command.connect
(\r) Reconnect to the server. Optional arguments are db and host.delimiter
(\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.edit
(\e) Edit command with $EDITOR.ego
(\G) Send command to mysql server, display result vertically.exit
(\q) Exit mysql. Same as quit.go
(\g) Send command to mysql server.help
(\h) Display this help.nopager
(\n) Disable pager, print to stdout.notee
(\t) Don't write into outfile.pager
(\P) Set PAGER [to_pager]. Print the query results via PAGER.print
(\p) Print current command.prompt
(\R) Change your mysql prompt.quit
(\q) Quit mysql.rehash
(\#) Rebuild completion hash.source
(\.) Execute an SQL script file. Takes a file name as an argument.status
(\s) Get status information from the server.system
(\!) Execute a system shell command.tee
(\T) Set outfile [to_outfile]. Append everything into given outfile.use
(\u) Use another database. Takes database name as argument.charset
(\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.warnings
(\W) Show warnings after every statement.nowarning
(\w) Don't show warnings after every statement.

本機端登入(-u 使用者 ;-p 是要輸入密碼)

1#mysql -u root -p
2Enter password:
3mysql>grant all privileges on *.* to root@"%" identified by "something" with grant option;
4mysql>set password for root@localhost=password("1234");
5mysql>set password for root@"%"=password("1234");
*.* 那個資料庫的.那個資料表---*.*就是所有的資料庫.所有的資料表的使用權限
to root@"%" 權限給予root ;@後接的是從那來的ip或網段;%表示所有來源
identified by "something" 進 入一定要驗証的密碼
第4行 設定 本機端root的使用密碼1234
第5行 設定 遠端root的使用密碼1234


遠端登入
#mysql -h 140.134.210.199 -u root -p (-h 主機)
遠瑞登入的設定
port的設定
使用者權限的制定

沒有留言: