How to Install MySQL 5.6, PHP 5.6, and WordPress 3.9 on CentOS 6
This step‑by‑step guide shows how to install MySQL 5.6, set up PHP 5.6 with Apache, and configure WordPress 3.9 on a CentOS 6 server, including database creation, wp‑config adjustments, and final file permissions.
Install MySQL 5.6
Remove any previously installed MySQL packages to avoid version conflicts: yum remove mysql* -y Add the official MySQL community repository for CentOS 6:
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmInstall the MySQL server package: yum install mysql-server -y Configure InnoDB to use a separate file per table (improves performance and simplifies backup). Edit /etc/my.cnf and add the following under the [mysqld] section:
[mysqld]
innodb_file_per_tableStart the MySQL service and run the security script to set a root password and remove default insecure settings:
service mysqld start
mysql_secure_installationVerify the installation by logging in with the root account:
mysql -uroot -pInstall Apache, PHP 5.6 and required extensions
Enable the Webtatic repository, which provides PHP 5.6 packages for CentOS 6:
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpmInstall Apache (httpd) and PHP 5.6 together with the most common extensions needed by WordPress:
yum install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap -yStart the Apache HTTP service and enable it to start on boot (optional):
service httpd start
chkconfig httpd onInstall WordPress 3.9 (Chinese language pack)
Extract the WordPress archive: unzip wordpress-3.9-zh_CN.zip Create a dedicated MySQL database and user for WordPress. Replace wordpress and the password with values of your choice:
mysql -uroot -p
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
FLUSH PRIVILEGES;Prepare the WordPress configuration file:
cd wordpress
cp wp-config-sample.php wp-config.php
vim wp-config.phpInside wp-config.php replace the placeholder constants with the database credentials you created:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpress');
define('DB_HOST', 'localhost');Copy the WordPress files to Apache's document root and adjust ownership so that the apache user can read/write as needed:
cp -r . /var/www/html/wordpress
chown -R apache.apache /var/www/html/wordpressOpen a web browser and navigate to the server's address (replace the IP with your own) to complete the web‑based setup wizard:
http://<em>YOUR_SERVER_IP</em>/wordpressSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
