Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Tuesday, 28 April 2015

Export and import command in mysql database


Import Command in mysql database


mysql -u root -p DATABASE_NAME < user.sql

Export Command in mysql database


mysql -u root -p DATABASE_NAME < data_file.sql

Thursday, 23 April 2015

How to Install Mysql in Ubuntu

Installing Mysql In Ubuntu

 follow these steps:
Step 1:

sudo apt-get update









Step 2:

sudo apt-get install mysql-server-5.6

Monday, 13 April 2015

RENAME Table AND Column Name In Mysql Database


Rename Table Name In Mysql:

RENAME TABLE  old_name_of_table To new_name_of_table;

Example:

RENAME TABLE user12 To user;


Rename Column Name IN Mysql

ALTER TABLE Table_name CHANGE Old_column_name New_column_name DataType

Example:


ALTER TABLE user CHANGE name user_name varchar(100);

Wednesday, 8 April 2015

How To get Default Character set of Database And Table in mysql


 If you want to know your mysql database default character set then use this
 query

SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA S WHERE schema_name="DATABASE_NAME";

Output:

+----------------------------+
| DEFAULT_CHARACTER_SET_NAME |
+----------------------------+
| latin1                     |
+----------------------------+


Get Table database default character set using this query

 SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
    information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = "DATABASE_NAME" AND T.table_name = "TABLE_NAME";


Output:

+--------------------+
| character_set_name |
+--------------------+
| latin1             |
+--------------------+