Ubuntu/mysql
From r00tedvw.com wiki
(Difference between revisions)
Line 18: | Line 18: | ||
mysqldump -u user -p db.name > wikidatabasebackup.sql | mysqldump -u user -p db.name > wikidatabasebackup.sql | ||
i.e. mysql -u wikiuser -p wikidb > /var/www/mediawiki/backup/wikidatabasebackup10_4_12.sql | i.e. mysql -u wikiuser -p wikidb > /var/www/mediawiki/backup/wikidatabasebackup10_4_12.sql | ||
+ | view all databases | ||
+ | ~$ mysql -u root -p | ||
+ | ~mysql>SHOW DATABASES; | ||
+ | +--------------------+ | ||
+ | | Database | | ||
+ | +--------------------+ | ||
+ | | information_schema | | ||
+ | | mysql | | ||
+ | | performance_schema | | ||
+ | +--------------------+ | ||
+ | 3 rows in set (0.00 sec) | ||
+ | |||
+ | delete (drop) a database | ||
+ | ~mysql> DROP DATABASE IF EXISTS <db name>; | ||
+ | Query OK, 11 rows affected (0.04 sec) |
Revision as of 01:31, 9 January 2015
- mysql is one of the most popular database applications on the market today
mysql login
mysql -u <user> -p
will then prompt you for a password
mysqladmin login
mysqladmin -u <user> -p
you can also run other commands after -p, such as:
see if the database is running
status
change MySQL root pass
sudo dpkg-reconfigure mysql-server-5.1
verify MySQL is running
sudo netstat -tap | grep mysql
backup wiki mysql database
sudo -s mysqldump -u user -p db.name > wikidatabasebackup.sql i.e. mysql -u wikiuser -p wikidb > /var/www/mediawiki/backup/wikidatabasebackup10_4_12.sql
view all databases
~$ mysql -u root -p ~mysql>SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec)
delete (drop) a database
~mysql> DROP DATABASE IF EXISTS <db name>; Query OK, 11 rows affected (0.04 sec)