W: H: YOffset??
Related Media
Categories   /  Tags

MySQL / MariaDB quick commands

Short snippets to manage the databases.

Database & user short cuts

 


# Log into MySQL as root:
mysql -u root
# Create a new database user:
GRANT ALL PRIVILEGES ON *.* TO 'db_user'@'localhost' IDENTIFIED BY 'P@s$w0rd123!';
# or just grant access to a database without password
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
# saving the data
FLUSH PRIVILEGES;
# Log out of MySQL by typing: \q.
# Log in as the new database user you just created:
mysql -u db_user -p
#create new database
CREATE DATABASE db_name;
#show the users databases
SHOW DATABASES;