MySQL login and database backup

Linode Staff

I need to login to MySQL and backup my database. How can this be done?

1 Reply

You'll need to login to your database server using the 'root' account that you setup for your database. This 'root' account will be different than the 'root' account for your server. You should be able to login to your database using the following syntax:

mysql -u root -p

To backup your database, you can use the 'mysqldump' command. Here's an example of this command:

mysqldump -u root -p database_name > database_name.sql

We actually have a guide on our docs page that you can reference in regards to backing up your database.

https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/#back-up-a-database

If you've forgotten the password for the 'root' account and need to reset this, I found another link in our community forum that will assist you with this process.
https://www.linode.com/community/questions/17930/retrieve-mysql-and-root-password

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct