標籤:查詢 innodb int 效果 刪除 資料庫版本 tab variables shel
*********串連
mysql -uroot -p123456 #預設會使用sock連接埠登入
mysql -uroot -p123456 -h127.0.0.1 -P3306 #使用ip+3306連接埠登入,遠程
mysql -uroot -p123456 -S/tmp/mysql.sock #使用監聽的sock;適合本機
mysql -uroot -p123456 -e "show databases" #使用在shell指令碼裡面
*********常用命令
一:
mysql 常用的命令:
查詢庫 show databases;切換庫 use mysql;查看庫裡的表 show tables;查看錶裡的欄位 desc tb_name;查看建表語句 show create table tb_name\G;查看目前使用者 select user();查看當前使用的資料庫 select database()*****************************************************************desc user; 查看一個表裡欄位有哪些show create table user\G; 加上G是比較有順序,整潔一點;select * from user\G; 加上G,效果同上;*****************************************************************查看mysql的命令曆史:ls -al #會看到有個檔案為 .mysql_historyless .mysql_history*****************************************************************use mysql;select database() #查看當前使用的資料庫*****************************************************************二:建立庫 create database db1;建立表 use db1;create table t1(‘id‘ int(4), ‘name‘ char(40) );查看當前資料庫版本 select version();查看資料庫狀態 show status;查看各參數 show variables;show variables like ‘max_connect%‘;修改參數 set global max_connect_errors=1000;查看隊列 show processlist; show full processlist; 建立庫,create database db1;show databases;use db1;create table t1(‘id‘ int(4), ‘name‘ char(40) );show create table t1\G;drop table t1;刪除此表create table t1(‘id‘ int(4), ‘name‘ char(40) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;show create table t1\G; 會看到charset 變成utf8;select version();show status;show variables;show variables like ‘max_connect%‘;或者查看 show variable like ‘sock%‘;set global max_connect_errors=1000;show variables like ‘max_connect%‘;這個修改為1000的數值,如果需要重啟也生效的話,就需要去修改my.cnf檔案;*****************************************************************show processlist; show full processlist; #此命令令可以查看:1.看看你的mysql在幹啥?2.哪些使用者在串連?3.串連的時候在幹啥,有沒有鎖表;
mysql--串連、常用命令