Showing posts with label mysql example. Show all posts
Showing posts with label mysql example. 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

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             |
+--------------------+