Mysql Tips for Beginners
* How to log into Mysql from command prompt?
First, Go to the Mysql installation directory and move to the bin directory (C:\Mysql\bin\)
Execute the following command to log into Mysql
C:\Mysql\bin> mysql -u [username] -p [password]
You will be shown mysql command which indicates that you have successfully logged in
mysql> _
How to backup a database?
From the windows directory (C:\Mysql\bin\), execute the mysqldump command as
C:\Mysql\bin> mysqldump -u [username] -p [password] databasename > db.dumpfile
The above command will dump a backup in the same directory.
Most common mistake that beginners make is users trying to execute the mysqldump command from within mysql>.
How to restore the mysql database?
From the command prompt, execute the following command
C:\Mysql\bin>mysql -u [username] [new_empty_database] < db.dumpfile
If [new_empty_database] is not already present, then you will get the following error
ERROR 1049 (42000): Unknown database ‘[new_empty_database]’