4 ways to start MySQL
It's all about calling the Mysqld file.
1. Mysqld Start
Enter the directory where the Mysqld file is located (/.. /LIBEXEC/MYSQLD)
./mysqld--defaults-file=./my.cnf--user=mysql
2. Mysqld_safe Start
Enter the directory where the Mysqld_safe is located (.. /bin/mysqld_safe)
./bin/mysqld_safe--defaults-file=./my.cnf--user=mysql
Mysqld_safe Restarts the mysqld process if the mysqld process is interrupted abnormally
3. Mysql.servre
Enter the directory where the Mysql.server is located (.. /share/mysql/mysql.server)
./mysql.server Start
Copy the Mysql.server file to the system boot directory to join the System program startup
CP./mysql.server/etc/rc.d/int.d/mysql
Chkconfig--add MySQL
Directly with server MySQL start
4.Mysqld_multi
Managing multiple databases
mysql_install_db initializing MySQL database commands
Add a new MySQL instance as an example. For example, a 3306-port MySQL service is already installed on the server and a 3308-port MySQL service needs to be restarted.
Assuming that MySQL is installed under the/usr/local/mysql path, find a disk space for the remaining large disk, such as/data1, to the 3308-port MySQL data saved under/data1
#mkdir/data1/mysql_3308
#mkdir/data1/mysql_3308/data
#chown-R mysql:mysql/data1/mysql_3308
Copy a MySQL configuration file my.cnf to the/data1/mysql_3308 directory
#vi/data1/mysql_3308/my.cnf
Modify the configuration file to change the port and related directories to the new settings as follows:
[Mysqld_multi]
Mysqld =/opt/mysql/bin/mysqld_safe//boot path
Mysqladmin =/opt/mysql/mysqladmin//responsible for printing status
User = Test//define Close users
Password = Test//Turn off MySQL user password, this user must have MySQL shutdown permission
[Client]
Character-set-server = UTF8
Port = 3308
Socket =/tmp/mysql_3308.sock
[mysqld3308]
user = MySQL
Port = 3308
Socket =/tmp/mysql_3308.sock
Basedir =/usr/local/mysql
DataDir =/data1/mysql_3308/data
Log-error =/data1/mysql_3308/mysql_error.log
Pid-file =/data1/mysql_3308/mysql.pid
...... Other slightly
Make sure the configuration file is correct.
Run the following command to initialize the database:
#/usr/local/mysql/bin/mysql_install_db--defaults-file=/data1/mysql_3308/my.cnf--datadir=/data1/mysql_3308/data
Start the 3308-port MySQL Service
#/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/DATA1/MYSQL_3309/MY.CNF &
Start
./bin/mysqld_multi--defaults-file=./my.cnf Start 3308
Shut down
./bin/mysqld_multi--defaults-file=./my.cnf Stop 3308
This article is from the users and stored procedures blog, so be sure to keep this source http://9548010.blog.51cto.com/9538010/1619802
4 ways to start MySQL