Home » Categories » Multiple Categories |
How To Import and Export Databases and Reset a Root Password in MySQL |
Article Number: 187 | Rating: Unrated | Last Updated: Sun, Jan 5, 2014 at 8:45 PM
|
How to Import and Export DatabasesExportTo Export a database, open up terminal, making sure that you are not logged into MySQL and type,mysqldump -u [username] -p [database name] > [database name].sqlThe database that you selected in the command will now be exported to your server instance. ImportTo import a database, first create a new blank database in the MySQL shell to serve as a destination for your data.CREATE DATABASE newdatabase;Then log out of the MySQL shell and type the following on the command line: mysql -u [username] -p newdatabase < [database name].sqlWith that, your chosen database has been imported into your destination database in MySQL. How to Reset a Root PasswordWhen you first install MySQL, you have to set up your root password. However, should you forget it at any point, you can still recover it.Step One—Shut Down MySQLIn terminal, stop the MySQL process/etc/init.d/mysql stop Step Two—Access MySQL Safe ModeIn safe mode, you will be able to make changes within the MySQL system with a root password alone, without the need for MySQL root password.sudo mysqld_safe --skip-grant-tables &Once safe mode has started up, log into MySQL and when prompted, use your standard root password. mysql -u root mysql Step Three—Set Up a New PasswordFinally, set up the new MySQL root password by typing the command below. Replace "newpassword" with the password of your choice.update user set password=PASSWORD("newpassword") where User='root';Be sure to reload everything: FLUSH PRIVILEGES;and you now have a new root password. |
Attachments
![]()
There are no attachments for this article.
|
How To Use WP-CLI to Manage your WordPress Site from the Command Line
Viewed 10173 times since Sat, Jan 4, 2014
How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Arch Linux
Viewed 4601 times since Fri, Dec 27, 2013
How To Install (LEMP) nginx, MySQL, PHP stack on Arch Linux
Viewed 13710 times since Sun, Dec 29, 2013
Upgrading Debian to Unstable
Viewed 3677 times since Thu, Dec 26, 2013
Intermediate Sed: Manipulating Streams of Text in a Linux Environment
Viewed 10083 times since Fri, Dec 27, 2013
How To Install Node.js with NVM (Node Version Manager) on Server
Viewed 3952 times since Sun, Dec 29, 2013
How To Create Data Queries in PostgreSQL By Using the Select Command
Viewed 14474 times since Mon, Dec 30, 2013
How To Set Up Apache Virtual Hosts on Ubuntu 12.04 LTS
Viewed 3587 times since Mon, Dec 23, 2013
How To Install and Use Memcache on Ubuntu 12.04
Viewed 3595 times since Tue, Dec 24, 2013
How To Configure and Maintain Ghost from the Command Line
Viewed 6678 times since Sun, Dec 29, 2013
|