Here are the steps for setting up a database for WordPress on a Ubuntu server(Assuming MySQL in already installed).
Log into mysql using root
''' sudo mysql -u root'''
Note: On new Ubuntu version password is not required.Create a database.
CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Or use UTF8mb4 if you want emojis.
CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARACTER SET UTF8mb4 collate utf8mb4_bin;
- Create a User
CREATE USER IF NOT EXISTS 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
CREATE USER IF NOT EXISTS 'wordpressuser'@'%' IDENTIFIED BY 'password';
- Grant privileges to the user
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'%';
5.
FLUSH PRIVILEGES;
6.
\q
Nuff said.
Top comments (0)