mysql (mariadb) commands useful for WordPress server:

Create a new database:


Create a user:

CREATE USER 'foo2'@'localhost' IDENTIFIED BY 'password';

Grant privileges on one specific database:
Database privileges are granted using db_name.* for priv_level, or using just * to use default database. Database privileges include privileges to create tables and functions, as well as privileges for all tables, functions, and procedures in the database. Database privileges are stored in the mysql.db table.

GRANT ALL PRIVILEGES ON  db1.* to 'foo2'@'localhost' WITH GRANT OPTION;
flush privileges;

Change root password:

use mysql;
update user set password=PASSWORD("NewPass") where User='root';

Create a new user:

CREATE USER 'Username'@localhost IDENTIFIED BY 'NewPass';

Give privileges on all databases:

GRANT ALL PRIVILEGES ON *.* TO 'Username'@localhost;

Change password for existing user:

SET PASSWORD FOR 'Username'@localhost = PASSWORD('NewPass');

Mariadb library

Joel G Mathew

Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an Android and Linux enthusiast. His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets. When away from the tech world, Joel is a practising ENT Surgeon.

Leave a Reply

Your email address will not be published. Required fields are marked *