Wednesday, October 9, 2013

MySQL Basics

The main configuration file of MySQL is my.cnf. The full path to the configuration file is /etc/my.cnf.
The main files of these database are normally located in /var/lib/mysql directory.

Basically one can see three types of files .frm, .myi, .myd.. But they are not same for all tables and db. They differ based on the engines you use and sometimes even differ with the os. There are lots of other factors that is in the backend behind the type of files you see. We will  see some basic differences.

.FRM  =>  It has the table structure of your table or table definition

.MYI  =>   It has the indexes of your table

.MYD =>   It contains your data

For ex: if your db name is school and tables called class and student. The Physical structure will have a directory called school and files class.frm, class.myi, class.myd, student.frm, student.myi, student.myd.

Engines Specific:
 
Lets consider table student belongs to innodb and table class has MyIsam
 
Innodb:
      Innodb has only .frm files and it has its own tablespace where it contains indexes and datas and its shared in databases. for ex: student.frm
 
MyISAM:
      MyIsam has all the three files. where .myi has your indexes, .myd has your table datas and .frm has its table definition. 
ex: class.frm, class.myi, class.myd
 
Need this:
 
   You can use these files when your db crash, or when you upgrade your db to another version and it can also be used while migrating and repairing your indexes without affecting data..
 
Bits and pieces
 
   This is for those who are not aware about engines. Apart from Innodb and MyIsam there are also some other engines in mysql such as Merge, Memory, Cluster etc..

Sunday, October 6, 2013

Backend commands to get Wordpress Details

Please select the appropriate database and enter the MySQL prompt. You can get the details of the database by checking the wp-config file.



select * from wp_options where `option_name` = 'siteurl';
select * from wp_options where `option_name` = 'home';
SELECT * FROM `wp_options` WHERE `option_name` = 'current_theme';
UPDATE `eugi12_wrdp1`.`wp_users` SET `user_pass` = MD5( '12345678' ) WHERE `wp_users`.`ID` =1;

Find the version of Wordpress : grep wp_version wp-includes/version.php

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews