這段時間在研究火車頭的入庫教程,在“配置登陸資訊和資料庫(mysql)”串連中,出現“伺服器串連錯誤Host 'XXX' is not allowed to connect to this MySQL server”的錯誤。像這種錯誤,就是典型的遠程許可權問題。問題癥結是MySQL 沒有開放遠程登入的許可權。這時要看你的伺服器到底用的那種系統,linux或者是Windows,這個解決辦法不同。解決的辦法就是開啟 MySQL
步驟非常的簡單,就三部搞定:1.建立bat檔案,bat檔案內容 代碼如下複製代碼 @echo off set host=localhost set username=root set passward=ansure set database=weihe set backup_path=D:/db_backup/ echo "Mysql Backup , please waitting" mysqldump -h%host% -u%username% -p%
mysql 分組 group by, 排序 取每條記錄中,時間最大的一條記錄以下是 test 表,測試sqlCREATE TABLE IF NOT EXISTS `test` (`id` int(10) unsigned NOT NULL auto_increment,`install` int(10) unsigned NOT NULL,`day` int(10) unsigned NOT NULL,`aid` int(10) unsigned NOT NULL,PRIMARY KEY
mysql查詢當天的所有資訊: 代碼如下複製代碼 select * from test where year(regdate)=year(now()) and month(regdate)=month(now()) and day(regdate)=day(now()) 這個有一些繁瑣,還有簡單的寫法: 代碼如下複製代碼 select * from table where date(regdate) = curdate();
區別對比儲存TIMESTAMP1.4個位元組儲存(Time stamp value is stored in 4 bytes)2.值以UTC格式儲存( it stores the number of milliseconds)3.時區轉化 ,儲存時對當前的時區進行轉換,檢索時再轉換回當前的時區。datetime1.8個位元組儲存(8 bytes storage)2.實際格式儲存(Just stores what you have stored and retrieves the same
mysql語句中group by 很容易理解 是分組查詢。比如 select sum(score) from user group by name 意思是查詢每個人的分數總和但是, select sum(score) from user group by item, sex 呢?下面是測試結果。測試資料如下:查詢結果如下:根據結果分析group by 多個欄位的含義是,分別以每個欄位的不同組合分組本例 item=數學 sex=1 和 item=數學 sex=2
ySQL查看使用者權限命令的兩方法:一. 使用MySQL grants使用方法: 代碼如下複製代碼 mysql> show grants for username@localhost;執行個體:mysql> show grants for root@localhost;+---------------------------------------------------------------------+| Grants for root@localhost&