This article will show you How to export a copy of the MySQL database in Command Line Interface and How to import an MYSQL database backup file to your database server by using command line interface.
Mysql DB Export
mysqldump -u username -p database_name > data-dump.sql
mysql -u [username] -p newdatabase < [database name].sql
Creating New Database
CREATE DATABASE newdatabase;
How to Reset a Root Password in Mysql Database
To reset Root Password in Mysql
First – Shut Down MySQL
In the terminal, stop the MySQL process
Two — Access MySQL Safe Mode
In safe mode, we can make changes without the need for MySQL root password.
sudo mysqld_safe --skip-grant-tables &
Once the safe mode has started up, log into MySQL and when prompted, use your standard root password.
mysql -u root mysql
Three — Set Up a New Password
Finally, set up the new MySQL root password by typing the command below. Replace a “tharun” to your choice.
update user set password=PASSWORD("tharun") where User='root';
Be sure to reload everything:
and you now have a new root password.