The previous installation of Nginx and PHP,MYSQLD services to join the start-up, the addition method is as follows:
Vi/etc/rc.local Add the following to boot from boot
[Email protected] extra]# vi/etc/rc.local
Append to last side of/etc/rc.local file
####/application/nginx/sbin/nginx/application/php/sbin/php-fpm/etc/init.d/mysqld start
Back up all libraries (no need to back up all libraries just need to back up the WordPress library)
[Email protected] ~]# mysqldump-uroot-p123456-a-B |gzip>bak.sql.gz
--warning:skipping The data of table mysql.event. Specify the--events option explicitly.
Back up the WordPress library
[Email protected] ~]# Cd/home/oldboy/tools
[Email protected] tools]# mysqldump-uroot-p123456 wordpress-b |gzip>bak.sql.gz
50-scale cluster LNMP component separation
1, LNMP integrated machine database separated into a separate database
A. Creating a stand-alone database 51
B. Exporting WordPress database data in LNMP
mysqldump-uroot-p123456 Wordpress-b |gzip>bak.sql.gz
C. Import into the 51 database
SCP bak.sql.gz [Email protected]:/tmp
[Email protected] mysql]# cd/tmp
[email protected] tmp]# LL
Total dosage 160
-rw-r--r--1 root root 159841 August 15:40 bak.sql.gz
srwxrwxrwx 1 mysql mysql 0 August 15:30 mysql.sock
[Email protected] tmp]# gzip-d bak.sql.gz
[email protected] tmp]# LL
Total Dosage 660
-rw-r--r--1 root root 673182 August 15:40 bak.sql
srwxrwxrwx 1 mysql mysql 0 August 15:30 mysql.sock
To set a password for a database
[Email protected] tmp]# mysqladmin-uroot password 123456
Import to Database
[Email protected] tmp]# mysql-uroot-p123456 </tmp/bak.sql
View Database
[[email protected] tmp]# mysql-uroot-p123456-e "show databases like ' WordPress ';"
+----------------------+
| Database (WordPress) |
+----------------------+
| WordPress |
+----------------------+
Enter the WordPress database to see if there is a table
[Email protected] tmp]# mysql-uroot-p123456-e "use wordpress;show tables;"
+------------------------+
| tables_in_wordpress |
+------------------------+
| Old_commentmeta |
| old_comments |
| Old_links |
| old_options |
| Old_postmeta |
| old_posts |
| Old_term_relationships |
| old_term_taxonomy |
| Old_termmeta |
| old_terms |
| Old_usermeta |
| Old_users |
+------------------------+
As the above operation can not be separated, because 51 database does not have an administrator, the administrator is located in the library in MySQL, so to add an administrator
Create a database wordpress Administrator account and password
Mysql> Grant all on wordpress.* to [e-mail protected] ' 172.16.1.% ' identified by ' 123456 ';
Query OK, 0 rows affected (0.03 sec)
Refreshing privileges
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
View MySQL data for all users
Mysql> select User,host from Mysql.user;
+-----------+------------+
| user | Host |
+-----------+------------+
| Root | 127.0.0.1 |
| WordPress | 172.16.1.% |
| Root | :: 1 |
| | DB01 |
| Root | DB01 |
| | localhost |
| Root | localhost |
+-----------+------------+
7 Rows in Set (0.00 sec)
51 on the database authorization, let. 8web can access
Stop the database inside the WEB01.
[[email protected] tools]#/etc/init.d/mysqld stop
Shutting down MySQL. success!
Boot MySQL boot also stop
[Email protected] tools]# Chkconfig mysqld off
Refresh in Browser again http://blog.etiantian.org/will prompt for database connection error
Operate on WEB01
[Email protected] tools]# cd/application/nginx/html/blog/
[[email protected] blog]# vim wp-config.php in 32 line localhost modified to 172.16.1.51
/** MySQL Host */
Define (' db_host ', ' localhost ');
Refresh the http://blog.etiantian.org/URL in the browser again to open the blog
Create a new post titled 666
In 51 database queries
[Email protected] tmp]# mysql-uroot-p123456
mysql> use WordPress;
Mysql> Show tables;
You can view the 666 title article as follows:
SELECT * from Old_posts\g;
The following is a 666 title article
11. row *************************** ID: 11 post_author: 1 post_date: 2017-08-27 16:15:28 post_date_gmt: 2017-08-27 08:15:28 post_content: 666 post_title: 666 post_excerpt: post_status: inherit comment_status: closed ping_status: closed post_password: post_name: 10-revision-v1 to_ Ping: pinged: post_modified: 2017-08-27 16:15:28 post_modified_gmt: 2017-08-27 08:15:28post_content_filtered: post_parent: 10 guid: http://blog.etiantian.org/?p=11 menu_order: 0 post_type: revision post_ mime_type: comment_count: 011 rows in set (0.00&NBSP;SEC)
This article is from the "Sandshell" blog, make sure to keep this source http://sandshell.blog.51cto.com/9055959/1959725
0537-Actual combat separate the databases in the LNMP service from the server