Jun 21
ใช้ mysqltuner แล้วพบว่า จำเป็นต้อง optimize tables แต่จะทำไงให้ optimize ได้ทุกตารางล่ะ
ใช้คำสั่งนี้ได้เลยครับ
mysqlcheck -Aao --auto-repair -u root -p[password]
-a, –analyze [Analyze given tables]
-o, –optimize [Optimize table]
-A, –all-databases [Check all the database]
–auto-repair [If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found]
หรือ จะใช้
mysqlcheck -uroot -p -ro –all-databases
-r = Can fix almost anything except unique keys that are not unique.
ก็จะสำเร็จเสร็จเรียบร้อย ที่เหลือก็แล้วแต่ปรับแต่งนะครับ
written by Mr-San
\\ tags: mysql, optimize
Mar 01
When I compile mysql, I need libmysqlclient_r.a how to get it? how and how.
Yep! I found, compile with ./configure –enable-thread-safe-client
written by Mr-San
\\ tags: configure, libmysqlclient_r, mysql
Jan 25
ใช้ทุกครั้งก็ต้องมาหาทุกครั้ง เลยมาจดไว้กันลืม
เป็นการสร้าง Database และ Grant ให้ User สามารถใช้งานร่วมกับ Database ได้
mysqladmin -u username -p create databasename
หลังจากนั้น login เข้าไปใน MySql
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';
เท่านี้ก็จะได้ User ที่สามารถใช้ร่วมกับ Database ที่สร้างขึ้นอย่างง่ายดาย
อ้อ อย่าลืม
FLUSH PRIVILEGES
written by Mr-San
\\ tags: create, database, grant, mysql
Dec 06
I found mysql have binary log and consume a lot of disk space, how to clear that I use log-bin instead of log file?
I search with google and I found RESET command with option MASTER
RESET MASTER
It used for deletes all binary logs listed in the index file, resets the binary log index file to be empty, and creates a new binary log file.
written by Mr-San
\\ tags: binary-log, mysql
Dec 04
After upgrade to Dapper, I found some problem with mysql (mysql-4.1.15) with thai language. My webpage display thai font to ???, why and why? When I try to re-import db and test with set names, it cannot solve my problem because my blog is UTF-8.
Then I found some option with skip-character-set-client-handshake in my.cnf (mysqld option) it can solve this problem and bring my web site back. Why?
This option is include in mysql-4.1.15 (Ooh, in Changelog) it used to ignore client information and use the default server character set.
written by Mr-San
\\ tags: mysql, thai-font, utf-8