MySql Starter

Software Development

To access a database:

mysql -h localhost -u ttrss -p ttrssdb

To list the tables in said database:

mysql> show tables;

To create a database as root, and a user to go with it:

mysql -u root -p
mysql> CREATE DATABASE ttrssdb;
mysql> GRANT ALL ON ttrssdb.* TO ttrss IDENTIFIED BY "ttrss";

Or:

mysql -u root -p
mysql> CREATE DATABASE piwikdb;
mysql> GRANT ALL ON piwikdb.* TO 'piwik'@'localhost' IDENTIFIED BY 'piwik';

To dump a database as root:

mysqldump -u root -p ttrssdb > ttrss.sql

And to import it back:

mysql -u root -p ttrssdb < ttrss.sql