MySQL

    Backup/Export

    	mysqldump -u root --password="secret" stocksdb > stocksdb.sql
    

    Note:

    -	for specific table `... --password="secret" stocksdb table1 table2 ... > stocksdb.sql`
    -	if you don't want to lock table, use((usefull when you have 1449 error code 'user is specified as a definer')) `--single-transaction`
    

    Restore/Import

    mysqldump -u root --password="secret" stocksdb < stocksdb.sql
    

    Note: Doesn't work everytime. So use :

    mysql -uroot -pstocksdb <stocksdb.sql
    

    Forgot root password

    service mysqld stop
    mysqld --skip-grant-tables --skip-networking &
    mysql mysql
    UPDATE user SET password=PASSWORD('NEW_PASSWORD') WHERE User="root" AND Host="localhost";
    service mysqld restart
    

    List Table Data

    Note : You will see the constraint name.

    SHOW CREATE TABLE table_name;