Tag Archives: MySQL

How to move a WordPress instance from one server to another Linux server

Motivation:

You want to move a WordPress instance from one server to another to consolidate your websites to reduce cost.

Solution:

Install and use below Duplicator plugin to achieve your goal.

https://wordpress.org/plugins/duplicator/

User guide: https://snapcreek.com/duplicator/docs/quick-start/

If everything goes well for you then congratulation!

Otherwise, please review below possible problems and corresponding solutions.


Problem 1:

You don’t have a website on the new server.

Solution 1:

1. Create a new virtual host in the /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/var/www/www.example.com"
</VirtualHost>

2. Set 775 permission for /var/www/www.example.com

3. Restart httpd service

sudo systemctl restart httpd

Problem 2:

You are using Amazon Linux 2 server.

You are logged in as ec2-user.

You use WinSCP to upload files and edit configuration files.

You cannot modify /etc/httpd/conf/httpd.conf and /etc/php.ini.

Solution 2:

1 View permission settings for the file

ls -ld /etc/httpd/conf/httpd.conf

The result indicates that the file owner is root user and root group, not ec2-user.

2. View groups of a user

groups ec2-user

The result indicates that the ec2-user does not belong to root group.

3. Add a user to root group

sudo usermod -a -G root ec2-user

4. Grant Read-Write permission against a file to root group

sudo chmod g+rwx /etc/httpd/conf/httpd.conf
sudo chmod g+rwx /etc/php.ini

5. Logout and login to the server again.


Problem 3:

You are using Amazon Linux 2 server. The ZipArchive feature is missing.

Solution 3:

1. Execute below commands:

sudo amazon-linux-extras install php7.2
sudo yum install php-pear php-devel gcc libzip-devel zlib-devel
sudo pecl install zip-1.13.5 # we must specify a slightly older version due due to compatibility

2. Add “extension=zip.so” to /etc/php.ini

3. Restart the server

sudo reboot

Problem 4:

You don’t have a WordPress database on the new Linux server.

Solution 4:

Execute below MySQL commands:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE `wp_database`;
GRANT ALL PRIVILEGES ON `wp_database`.* TO "username"@"localhost";
FLUSH PRIVILEGES;

Problem 5:

An database error occurs while restoring a website.

Solution 5:

1. Execute below commands to remove the website:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;
rm -r /var/www/example.com

2. Upload the Duplicator files again, and restore the website again.


Problem 6:

No write access against /var/www/example.com is available for Duplicator.

Solution 6:

1. Execute below commands:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;

2. Run http://example.com/installer.php again.

Topic 7 – Introduction to Database Management Systems

Why do I need to learn about database management systems?

Your software must help users to do their work. The most important part of the users’ work is the information. You need to learn about database management systems to store, manipulate, retrieve and secure this information.

What can I do after finishing learning database management systems?

You can create enterprise systems, such as airlines and railways, banking, education, telecommunications, digital libraries and digital publishing, finance, sales, health care information systems.

It sounds interesting! What should I do now?

Learning about database management systems requires a lot of effort. First you need to learn how to use database management systems.

Please read
– this Ignatius Fernandez (2015). Beginning Oracle Database 12c Administration: From Novice to Professional. Apress book, or
– this Adam Jorgensen et al. (2012). Microsoft SQL Server 2012 Bible. Wiley book, or
– this Vinicius M. Grippa and Sergey Kuzmichev (2021). Learning MySQL. O’Reilly Media book, or
– this Regina O. Obe and Leo S. Hsu (2017). PostgreSQL Up and Running. O’Reilly Media book.

After that please read
– this Jeff Carpenter and Eben Hewitt (2020). Cassandra: The Definitive Guide: Distributed Data at Web Scale. O’Reilly Media book, and
– this Bradshaw Shannon, Eoin Brazil and Kristina Chodorow (2019). MongoDB: The Definitive Guide: Powerful and Scalable Data Storage. 3rd Edition. O’Reilly Media book.

Terminology Review:

  • Database Management Systems
  • Relational Databases
  • (Oracle) Tablespaces, Datafiles, and Objects
  • (Oracle) Databases, Instances, Schemas
  • Entity-Relationship Model
  • SQL, TSQL
  • Stored Procedures
  • Functions
  • Relational Model
  • Joins
  • Subqueries
  • Views
  • Common Table Expressions
  • Indexes
  • Recovery
  • Replication
  • NoSQL
  • Key-Value Databases
  • Document Databases
  • Column-Family Databases

After finishing learning about database management systems please click Topic 8 – Introduction to Web Application Development to continue.