[mac] mysql2 gem: Don’t know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load

這幾天在裝 mysql2 gems 時發生如下的錯誤 原因主要是 ld: library not found for -lssl 通常是 openssl 未安裝或路徑設定有誤 可以先試著重裝 openssl ,必且重新設定對應的環境變數 重新安裝 mysql2 gem 應該就正常囉! 參考資料: https://stackoverflow.com/questions/30834421/error-when-trying-to-install-app-with-mysql2-gem/30837897#30837897?newreg=a89c9550c93f4e7c84db03b8c15ff3d9

Continue reading


[mysql] InnoDB: Table `mysql`.`innodb_table_stats` not found.

前陣子裝了 mysql,但似乎沒裝完整,導致執行 mysql 機器負載總是衝很高。 看了一下 mysql error.log InnoDB: Table `mysql`.`innodb_table_stats` not found. Table ‘performance_schema.session_variables’ doesn’t exist 嗯…連 show variables; 都無法執行 查了一下相關資料,用以下步驟即可解決。 強制更新 mysql mysql_upgrade -u root -p –force 重開 mysql sudo service mysql restart   參考資料: https://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist    

Continue reading


[mysql] start: Job failed to start invoke-rc.d: initscript mysql, action “start” failed. ,完整移除並重新安裝

剛好同事遇到 mysql 無法正常開啟,但重裝(sudo apt-get install mysql-server-5.6)時卻一直顯示 start: Job failed to start invoke-rc.d: initscript mysql, action “start” failed. dpkg: error processing mysql-server-5.5 (–configure): subprocess installed post-installation script returned error exit status 1 或是 Unable to set password for the mysql “root” user….. 嘗試執行 mysql 也會寫著服務的 socket 未開啟 ERROR 2002 (HY000): Can’t connect to local MySQL server […]

Continue reading


[mysql] 新增使用者及權限設定

每次要設定 mysql 的資料庫給外面的廠商,都一直忘記指令…… 來記錄一下指令~ 新增使用者 INSERT INTO user(host,user,password) VALUES(‘%’,’camel’,password(‘2243’)); 授予特定資料庫全部權限(camel/2243) GRANT ALL ON dbname.* TO ‘camel’@localhost IDENTIFIED BY ‘2243’; 移除使用者(camel)特定資料庫權限 REVOKE ALL PRIVILEGES ON dbname.* FROM ‘camel’@’localhost’; 移除使用者(camel) DROP USER ‘camel’@’localhost’;   參考資料: http://blog.toright.com/posts/1214/mysql-%E6%96%B0%E5%A2%9E%E4%BD%BF%E7%94%A8%E8%80%85%E8%88%87%E6%AC%8A%E9%99%90%E8%A8%AD%E5%AE%9A-%E7%AD%86%E8%A8%98.html  

Continue reading