Page tree
Skip to end of metadata
Go to start of metadata

Common Administration Commands

User Management

Show list of users,

select User from mysql.user;
+------------------+
| User             |
+------------------+
| root             |
| root             |
| debian-sys-maint |
| root             |
+------------------+ 

Drop a user, changing name to the matching name,

delete from mysql.user WHERE User='name';

Database Management

List databases,

SHOW DATABASES;
mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.16 sec)

In this case, so far only the three default databases exist,

To create you own database, create a user and grant that full administrator privileges,

CREATE DATABASE wpdailyplanetdb;
GRANT ALL PRIVILEGES ON wpdailyplanetdb.* TO 'wpdpdbuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Adjust the variables for your application.

wpdailyplanetdb - Name of the database for the WordPress application instance. We use the domain name of the website.

wpdpdbuser - User account for accessing the database cannot be longer than 16 characters

localhost - Address of the database server. In this example, the database is on the same server so use localhost.

password - Change to password using algorithm based on name of the primary website domain, in this case dailyplanet.

This example grants all privileges to the WordPress application for initial setup. After the setup is done we would restrict to more minimal privileges.

mysql commands

  • No labels