Create Db + User
mysql> CREATE DATABASE mydb mysql> CREATE USER 'pfowler'@'%' IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON mydb.* TO 'pfowler'@'%' WITH GRANT OPTION;
Misc MySQL Commands
# List databases mysql> show databases; # Switch db mysql> use [db name]; # Show tables mysql> show tables; # Show table details mysql> describe [table name]; # Show column details mysql> show columns from [table name]; # Upgrade tables mysql_fix_privilege_tables --password=[root password]
Reset root password
# Stop mysqld /etc/init.d/mysql stop # Start server without grants mysqld_safe --skip-grant-tables & # Connect mysql -u root # Set new password mysql> use mysql; mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit # Stop mysql /etc/init.d/mysql stop # Test /etc/init.d/mysql start mysql -u root -p