Create a MySQL database with its own user
create new mysql database | create database and user | create database for wordpress | mysql | mariadb | users | databaseCaution: This command changes the system. Understand what it does before you run it.
mysql -e "CREATE DATABASE wp_example CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'wp_example_user'@'localhost' IDENTIFIED BY 'SecurePassword'; GRANT ALL PRIVILEGES ON wp_example.* TO 'wp_example_user'@'localhost';"Creates a database with full Unicode support (utf8mb4, which also covers emojis in content), creates a local user and grants it all privileges on this database only. This is the usual foundation for WordPress and other web applications.
Note: On Plesk servers, create databases through Plesk, otherwise Plesk does not know about them for backups and management. The password ends up in the shell history.
Also searched as
- create new mysql database
- create database and user
- create database for wordpress