/data
-- -- -- -- -- - 3306
-- -- -- -- -- -- -- -- -- -- data
-- -- -- -- -- -- - 3307
-- -- -- -- -- -- -- -- -- -- - data
# # # 3306
# The following options will be passed to all MySQL clients
[client]
# password=your_password
Port=3306
Socket=/data/3306/mysql. The sock
# Here follows entries for some specific designed
# The MySQL server
[mysqld]
Port=3306
Socket=/data/3306/mysql. The sock
Datadir=/data/3306/data
Long_query_time=1
# the log - error=/data/3306/error. The log
# the log - missile - the queries=/data/3306/missile. The log
Pid - file=/data/3306/mysql. Pid
# the log - bin=/data/3306/mysql - bin
Relay - log - info - the file=/data/3306/relay - the info
Server - id=1
The log - error=/data/3306/mysql_3306. Error
Pid - file=/data/3306/mysqld. Pid - the file
User=mysql
# # # 3307
# The following options will be passed to all MySQL clients
[client]
# password=your_password
Port=3307
Socket=/data/3307/mysql. The sock
# Here follows entries for some specific designed
# The MySQL server
[mysqld]
Port=3307
Socket=/data/3307/mysql. The sock
Datadir=/data/3307/data
Long_query_time=1
# the log - error=/data/3307/error. The log
# the log - missile - the queries=/data/3307/missile. The log
Pid - file=/data/3307/mysql. Pid
# the log - bin=/data/3307/mysql - bin
Relay - log - info - the file=/data/3307/relay - the info
Server - id=3
The log - error=/data/3307/mysql_3307. Error
Pid - file=/data/3307/mysqld. Pid
The startup script
#!/bin/sh
# This is an interactive program, we needthe current locale
[-f/etc/profile. D/lang. Sh] & amp; & ./etc/profile. D/lang. Sh
# We can 't Japanese on normal console atboot time, so the force.
If [$LANG, ""=" ja "-o" $LANG "=" ja_JP. EucJP "]. Then
If [" TERM "=" Linux "]. Then
LANG=C
Fi
Fi
# Source function library.
./etc/init. D/functions provides
# init
Port=3306
Mysql_user="root"
Mysql_pwd="123456"
CmdPath="/application/mysql/bin"
Mysql_sock="/data/${port}/mysql. The sock"
# startup function
Function_start_mysql ()
{
If [! - "$e mysql_sock"]. Then
Printf "Starting MySQL...
\ n"The ${CmdPath}/mysqld_safe - defaults - file=/data/${port}/my CNF - ledir=${CmdPath} 2 & gt; & 1 & gt;/dev/null & amp;
Sleep 2
The else
Printf "MySQL is running...
\ n"The exit
Fi
}
# stop function
Function_stop_mysql ()
{
If [! - "$e mysql_sock"]. Then
Printf "MySQL is stopped...
\ n"The exit
The else
Printf "Stoping MySQL...
\ n"${CmdPath}/mysqladmin - u ${mysql_user} - $p ${mysql_pwd} - S mysql_sock shutdown
Sleep 2
Fi
}
# restart function
Function_restart_mysql ()
{
Printf "Restarting MySQL...
\ n"Function_stop_mysql
Sleep 2
Function_start_mysql
}
In case $1
Start)
Function_start_mysql
;;
Stop)
Function_stop_mysql
;;
Restart)
Function_restart_mysql
;;
Status)
The status mysqld
;;
*)
Usage: printf "/data/${port}/mysql {start | stop | restart | status} \ n"
Esac
/usr/local/mysql/bin/mysqld_safe - defaults - file=/data/3306/my CNF start without question
But if use the script to start the above will go wrong,
[root @ localhost 3306] # mysql start
ERROR 2002 (HY000) : Can 't connect to local MySQL server through socket'/TMP/MySQL. So
CodePudding user response:
[root @ localhost 3306] # mysql startERROR 2002 (HY000) : Can 't connect to local MySQL server through socket'/TMP/MySQL. The sock '(2)
CodePudding user response:
./data/3306/my conf./data/3307/my CNF