Category: Database

change the database engine of a MySQL database table?

Different databse engines can use for database tables. Database engines are different in architecture. Some occasions demands the db engine change  of table. Usually tables are creating in MyISAM storage engine InnoDB is the another option.It has advantages over MyISAM. InnoDB gives more importance to relational schema. We can do it easily by mysql query Take

removing or adding a prefix on existing tables in mysql

<?php $db_password = ‘root’; $db_user = ‘root’; $db_host = “-h localhost”; // Probably localhost $db_name = ‘test’; $prefix =’smarttips_’; $remove = ‘removeprefix’;//set a a condition name if(strtolower($remove) == ‘removeprefix’ || strtolower($remove) == ‘remove’){ $removeprefix = (bool) TRUE; } else { $removeprefix = (bool) FALSE; } $renmeQuery = “mysql -u$db_user -B -p$db_password -s -r $db_host $port

Import and export large database in phpmyadmin

Ubuntu use the terminal windows can use the command prompt for run the following command. command: sudo mysql -u root -p”root” ur database name < source sql file path Eg:sudo mysql -u root -proot projects_unii-v16</var/www/projects_unii-v16.sql

mysql table alter query

We can use the following query for add new field to table. this types of queries are alter queries Syntax :ALTER `<table name>` ADD `<fieldname>` <type> <option> Example: ALTER TABLE `engine4_core_poll_societies` ADD `soc_admin` INT NOT NULL