Archive

Archive for the ‘MySQL’ Category

Sanitize MySQL Inputs

November 13th, 2009 No comments
Sanitize MySQL Inputs Prepare the data so that when it gets added to your SQL query it doesn’t break the server ( Defence SQL injection attack ). When a form has been submitted via GET or POST all data is stored in the ...

Can’t find file: ‘./mysql/host.frm’

July 28th, 2009 No comments
Can’t find file: ‘./mysql/host.frm’ If the mysql log - /var/log/mysqld.log (fedora distro) - says: 090728 02:56:59 mysqld started 090728 2:56:59 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13) 090728 2:56:59 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13) 090728 2:56:59 [ERROR] Fatal error: Can't ...

Mysql Optimization and Tunning Script

April 7th, 2009 No comments
Mysql Optimization and Tunning Script Linux - for mysql tunning use MySQLTuner script. MySQLTuner is a script written in perl that will assist you with your MySQL configuration & make recommendations for increased performance and stability. Download the latest MySQLTuner version in plain text to your ...

Mysql Query – Get Number of Rows in a Mysql Database Table

March 5th, 2009 No comments
Mysql Query – Get Number of Rows in a Mysql Database Table 1'st Solution, use Mysql COUNT(*) : $sql = "SELECT COUNT(*) FROM my_table"; $result = mysql_query($sql); $num = mysql_result($result, 0); echo $num; 2'nd solution: use TABLE_ROWS and TABLE_NAME from information_schema: $query = "select TABLE_ROWS from information_schema.tables where table_schema = 'my_data_base' AND TABLE_NAME = 'my_table' "; $result = mysql_query($query); $count ...

Get current AUTO_INCREMENT value – MySQL query

January 29th, 2009 No comments
Get current AUTO_INCREMENT value – MySQL query Solution is simple, use mysql_insert_id() php function. mysql_insert_id() returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement. Use this function after you have performed an INSERT statement into a table that contains an AUTO_INCREMENT field, ...

Recover accidentally removed table files from a MySQL Server

June 19th, 2008 3 comments
Recover accidentally removed table files from a MySQL Server How to recover accidentally deleted MySQL database files if someone accidentally removed all table files from a MySQL Server's data directory with a linux shell script? Will be surprised to find out that the linux server continued to serve requests ...

Mass Replace String in MySQL Table Database

June 13th, 2008 No comments
Mass Replace String in MySQL Table Database There are basically 2 ways suggested method: 1st, save/copy the database table and use text editor's "search and replace" function and fill table with new content; 2'nd , use MySQL REPLACE function: UPDATE table_name SET column_name = REPLACE(column_name,"original_text","replace_text")

Z0ey Zan3 , de ce sunt offline !

November 29th, 2007 10 comments
Z0ey Zan3 , de ce sunt offline ! Z O E Y - Z A N E , este cauza pentru care astazi mai tot timpul am fost OffLINE. Observati ca nici nu am mai scris impreunat ;) iar in titlu am inlocuit din caractere ... nu mai ...

Search and Replace in MySQL Database

November 28th, 2007 No comments
Search and Replace in MySQL Database use MySQL REPLACE function! 1. BACKUP YOUR DATABASE FIRST. 2. From within phpMyAdmin, open your database. 3. And here is the SQL query to replace string in database table: UPDATE table_name SET column_name = REPLACE(column_name,"original_string","replace_string")

Repair MySQL Tables

November 17th, 2007 No comments
Repair MySQL Tables   How to Repair MySQL Tables ? 1. Login on server 2. Type next linux command in your mysql folder with MYI files : myisamchk -r --sort-index --analyze *.MYI folder ex: /var/lib/mysql/yourdatabase/ *NOTE: - DO NOT TYPE ANYTHING BEFORE BACKUP DATABASE! - If you request warnig about table ...
GoCache - ByREV-Cache v1.0 - live served in : 0.446594 sec (gzip)