標籤:1.建立資料庫create database school;2.使用資料庫Use school;3.建立使用者create user [email protected] identified by ‘jame‘;4.授權使用者(注意這裡是用了*哦,可以自己講school也替換成*號)grant select,update,insert,create on school.* to [email protected] identified by ‘j
標籤:1.對查詢進行最佳化,應盡量避免全表掃描,首先應考慮在 where 及 order by 涉及的列上建立索引。2.應盡量避免在 where 子句中對欄位進行 null 值判斷,否則將導致引擎放棄使用索引而進行全表掃描,Sql 代碼 : select id from t where num is null;可以在 num 上設定預設值 0,確保表中 num 列沒有 null 值,然後這樣查詢:Sql 代碼 : select id from t where num=0;3.應盡量避免在
標籤:mysql#在[client]欄位添加[client]default-character-set=utf8#在[mysqld]欄位添加[mysqld]character-set-server=utf8#在[mysql]欄位添加[mysql]default-character-set=utf8#修改完成後重啟mysql~$ sudo /etc/init.d/mysql restart#查看效果mysql> show variables like ‘%char%‘;+----------
標籤:1.mysql服務的啟動和停止net stop mysqlnet start mysql 2.登陸mysqlmysql -u使用者名稱 -p使用者密碼如: mysql -uroot -p 斷行符號, 輸入密碼如(123456)斷行符號,成功則顯示如下:mysql>如果是串連到另外的機器上,則需要加入一個參數 -h機器IP 3.增加新使用者grant 許可權 on 資料庫.* to 使用者名稱@登陸主機 identified by
標籤:原因1. MySQL 服務宕了 判斷是否屬於這個原因的方法很簡單,執行以下命令,查看mysql的運行時間長度 $ mysql -uroot -p -e "show global status like ‘uptime‘;" +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Uptime | 68928 | +--
標籤:跨伺服器mysql訪問, iptables配置 1> 設定被訪問機器的mysql許可權 grant all privileges on *.* to [email protected]"[ip]" identified by "[pass]" with grant option; // 授權, 可以根據情況設定不同許可權, 本sql賦予遠程機器所有mysql操作許可權 flush privileges; // 重新整理許可權