標籤:建立資料庫: create database [if not exits] 資料庫名 [資料庫選項]; 說明: 資料庫名: 可以是任意的字元,但是特殊字元需要使用反引號包裹,標示符的大小用於區別作業系統的大小寫特徵 if not exists 表示在資料庫不存在是建立 資料庫選項: 包含 資料庫字元集 (character set utf8)、校對集(collate utf8_general_ci) 註:使用 show character
標籤:explain顯示了mysql如何使用索引來處理select語句以及串連表。可以協助選擇更好的索引和寫出更最佳化的查詢語句。使用方法,在select語句前加上explain就可以了:如:explain select surname,first_name form a,b where a.id=b.id EXPLAIN列的解釋:table:顯示這一行的資料是關於哪張表的type:這是重要的列,顯示串連使用了何種類型。從最好
標籤:這幾天工作當中,在使用mysql資料庫的時候,碰到了too many connections的問題和timeout expired的問題,經過嘗試,稍作總結,希望能夠幫到需要的朋友;在測試當中發現,1:too many connections的錯誤會在max pool size的值大於max_connections的值,而且串連池中的串連全部被佔用,並且有新的串連請求的時候出現;2:timeout expired的錯誤會在max pool
標籤:1.ERROR 2013 (HY000): Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 0Tcpwarpper阻擋了,編輯/etc/hosts.allow,加上這兩行#/etc/hosts.allowsshd : ALL: ALLOWmysql: ALL : ALLOW 這個錯誤還有種可能是 刪除了所有的mysql帳號,解決方案見42.mysql
標籤:1,SHOW PROCESSLIST查看資料庫中表的狀態,是否被鎖;kill id //殺掉被鎖的表===================================================set autocommit=0;select * from t1 where uid=‘xxxx‘ for update //在有索引(例如uid)的情況下是行鎖,否則是表鎖insert into t1 values(1,‘xxxxx‘)
標籤:用子查詢語句來影響子查詢中產生結果rows的數量和順序. For example:SELECT * FROM t1 WHERE t1.column1 IN (SELECT column1 FROM t2 ORDER BY column1);SELECT * FROM t1 WHERE t1.column1 IN (SELECT DISTINCT column1 FROM t2);SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t2
標籤:1:查看版本SELECT VERSION(); 2:查看當前的日誌儲存方式mysql> SHOW VARIABLES LIKE ‘%log_output%‘;+---------------+-------+| Variable_name | Value |+---------------+-------+| log_output | TABLE |+---------------+-------+1 row in set (0.00
標籤: 【error】 install_driver(mysql) failed: Global symbol "$VERSION" requires explicit package name at /mtkoss/perl/5.14.2-ubuntu-12.04/x86_64/lib/site_perl/5.14.2/x86_64-linux-thread-multi/DBD/mysql.pm line 6. Compilation failed in require at