The following articles mainly describe how to correctly use the MySQL (the best combination with PHP) service, and the related content of MySQL maintenance and actual application design notes, this article focuses on the following several practical considerations for MySQL (the best combination with PHP) service planning and design.
1. The installation/configuration versatility of MySQL (the best combination with PHP) service;
2. Easy system upgrade and data migration;
3. fast backup and System Recovery;
Plan the MySQL (best combination with PHP) Server
In order to maintain MySQL in the future, upgrade the backup convenience and data security, it is best to install MySQL (the best combination with PHP) program files and data on "different hardware" separately.
/
/Usr <= operating system }=> Hard Disk 1
/Home/MySQL (the best combination with PHP) <= MySQL (the best combination with PHP) Application
...
/Data/app_1/<= Application data and script} => Hard Disk 2
/Data/app_2/
/Data/app_3/
Install MySQL (the best combination with PHP) and start the service:
MySQL (the best combination with PHP) generally uses the current STABLE version. Do not use the -- with-charset = option whenever possible, I feel that with-charset is only useful in alphabetical order. These options can cause a lot of trouble for data migration.
Configure -- prefix =/home/MySQL (the best combination with PHP)
Make
Make install
Service start and stop
1. Copy the default MySQL (the best combination of maintenance and PHP)/var/MySQL (the best combination with PHP) to the/data/app_1/directory.
2 MySQL (the best combination with PHP) d startup script:
Start_MySQL (the best combination with PHP). sh
- #!/bin/sh
- rundir=`dirname "$0"`
- echo "$rundir"
/Home/MySQL (the best combination with PHP)/bin/safe_MySQL (the best combination with PHP) d -- user = MySQL (the best combination with PHP) -- pid-file = "$ rundir"/MySQL (the best combination with PHP ). pid -- datadir = "$ rundir"/var "$ @"\
-O max_connections = 500-O wait_timeout = 600-O key_buffer = 32 M -- port = 3402 -- socket = "$ rundir"/MySQL (the best combination with PHP). sock &
Note:
-- Pid-file = "$ rundir"/MySQL (the best combination with PHP ). pid -- socket = "$ rundir"/MySQL (the best combination with PHP ). sock -- datadir = "$ rundir"/var
The purpose is to put the corresponding data and temporary application files together;
-O is generally followed by the global variable optimization Parameter for server startup, and sometimes needs to be adjusted according to the specific application;
-- Port: different applications use PORT parameters to distribute to different services. The number of connections that a service can provide is generally the main bottleneck of MySQL maintenance (the best combination with PHP) services;
After modifying different services to different ports, add the following to the rc. local file:
/Data/app_1/start_MySQL (the best combination with PHP). sh
/Data/app_2/start_MySQL (the best combination with PHP). sh
/Data/app_3/start_MySQL (the best combination with PHP). sh