AMIMOTO Database Operations

Enable phpMyAdmin in Amimoto

If you want to use phpMyAdmin for the database operation in Amimoto, you must rewrite the or default.conf located in the / etc / nginx / conf.d /.

(This description is for Amimoto AMI EC2 instance with Self-Hosting, and phpMyAdmin is enabled with Managed Hosting Services.)

The user of the .conf file is root, so please switch to the root user with su -, then edit the file.

You will find below around L.61,

##include /etc/nginx/phpmyadmin;
location ~* /(phpmyadmin|myadmin|pma) {
    access_log off;
    log_not_found off;
    return 404;

Change to:

include /etc/nginx/phpmyadmin;
#location ~* /(phpmyadmin|myadmin|pma) {
# access_log off;
# log_not_found off;
# return 404;


After rewriting # service nginx restart , restart the Nginx.
You can access the phpMyAdmin in after you restart.

Login username and password of phpMyAdmin will be the username and password for the database and they are written in the wp-config.php.

You can use phpMyAdmin after the process above. In addition, replace the default.conf, and please be sure that you disable the phpMyAdmin after use. Unfortunately, many vulnerabilities have been discovered in the past phpMyAdmin, there were a large number of unauthorized access, even if you do not have the installation. For the reason, with Amimoto, phpMyAdmin is disabled by default even though it is installed.

Database Operations using WP-CLI

Database operations can be managed by the command-line tools of WP-CLI.
※ WP-CLI is installed by default after ver1.1 of Amimoto.

Below is the typical command database operations.

In addition, if you can work with phpMyAdmin or mysql command general, you must enter a username, database name, and password, but using WP-CLI, those informations are gotten from wp-config.php. So there is no need to enter the informations with command

Database export

wp db export []

The filename is any + .sql.
Sql file is created when the operation completes.

Database import

wp db import []

sql file is the file that had been uploaded to the server in advance.

String substitution in the database

For example, if you want to change to from for the address of a WordPress site, such as during migration.

wp search-replace

Serialized strings are handled properly, even in the replacement target. --dry-run you can see the report without replacement if you specify the options.

Password resetting (e.g. if your registered email address is wrong and you can’t receive the password recovery mail)

wp user update  --user_pass = marypass

Specify either a login name, email address, or user ID. --user_pass is to set a new password.

Optimization of database

wp db optimize

There are a lot of commands that are related to the database, so please refer to the official documentation.