MySQL is the most popular open source relational database management system (RDBMS) in the world. MySQL is used by everyone from the simple small business website to the large internet giants like Facebook, Google or Amazon. In fact the contents of this page are even stored within MySQL.
Installing MySQL is a fairly common task for any systems administrator; especially if that administrator is running a standard LAMP stack (Linux, Apache, MySQL & PHP/Python/Perl).
Tee is a unix command that takes the standard out output of a Unix command and writes it to both your terminal and a file. Until recently I never knew there was a MySQL client command that performed the same function. Today I will show you an example of how to use it.
First login to the MySQL CLI (command line interface)
$ mysql -uroot -p Enter password: Welcome to the MySQL monitor.
Mysqldump is a great utility for backing up or exporting a database to a flat file. This flat file can then be used to import the database or databases into another mysql database or even another database server like postgre depending on the options you use.
To perform a very simple backup of the mysql database you can simply just setup a cronjob that runs mysqldump at whatever interval you want.
While the specific commands below were used to create a test database for wordpress the same commands will apply for most situations where you want to create a mysql database and a user with appropriate privileges to that database.
$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 39304 Server version: 5.1.54-1ubuntu4 (Ubuntu) First log into the mysql command line interface using the mysql command.
While I am sure there are multiple ways to do this and some probably easier here is a way to backup your mysql user privileges to a CSV file.
First you will need to get to the mysql cli.
# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 35083 Server version: 5.0.51a-24+lenny3 (Debian) Type 'help;' or 'h' for help.