Pit 1: mysql-5.5.32.tar.gz source package not found
It took a lot of effort to find:
MySQL Source package:
https://downloads.mysql.com/archives/community/
Download path
Https://downloads.mysql.com/archives/get/file/mysql-5.5.32.tar.gz
How did I find the fish?
Pit 2:cmake configuration error because \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ CMake compile parameters correctly:
CMake. -dcmake_install_prefix=/application/mysql-5.5.32 \
-dmysql_datadir=/application/mysql-5.5.32/data \
-dmysql_unix_addr=/application/mysql-5.5.32/tmp/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-DEXTRA_CHARSETS=GBK,GB2312,UTF8,ASCII \
-denabled_local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwithout_partition_storage_engine=1 \
-dwith_fast_mutexes=1 \
-dwith_zlib=bundled \
-denabled_local_infile=1 \
-dwith_readline=1 \
-dwith_embedded_server=1 \
-dwith_debug=0
Pit 3:mysql After a multi-instance execution starts, the port does not start, and the view log finds an error.
[[email protected] 3306]#/data/3306/mysql start
Starting MySQL ...
[[email protected] 3306]#/data/3307/mysql start
Starting MySQL ...
[Email protected] 3306]# Netstat-lntup|grep 330
[email protected] 3306]# cat Mysql_oldboy3306.err
180302 12:29:03 Mysqld_safe starting mysqld daemon with databases From/application/3306/data
180302 12:29:03 [Warning] Can ' t ' Create test File/application/3306/data/db02.lower-test
180302 12:29:03 [Warning] Can ' t ' Create test File/application/3306/data/db02.lower-test
/application/mysql-5.5.32/bin/mysqld:can ' t change dir to '/application/3306/data/' (errcode:2)
180302 12:29:03 [ERROR] Aborting
180302 12:29:03 [Note]/application/mysql-5.5.32/bin/mysqld:shutdown complete
180302 12:29:03 mysqld_safe mysqld from PID File/data/3306/mysqld.pid ended
Key error log points are:
180302 12:29:03 [Warning] Can ' t ' Create test File/application/3306/data/db02.lower-test
180302 12:29:03 [Warning] Can ' t ' Create test File/application/3306/data/db02.lower-test
/application/mysql-5.5.32/bin/mysqld:can ' t change dir to '/application/3306/data/' (errcode:2)
This was carefully examined because the DataDir path was pointed to/application/3306/data in the multi-instance configuration file.
3307 Example error is the same.
Modify the datadir=/data/3307/data in 3306 and 3,307 multi-instance my.cnf after starting two instances OK
[[email protected] 3306]#/data/3306/mysql start
Starting MySQL ...
[[email protected] 3306]#/data/3307/mysql start
Starting MySQL ...
[Email protected] 3306]# Netstat-lntup|grep 330
TCP 0 0 0.0.0.0:3306 0.0.0.0: LISTEN 19701/mysqld
TCP 0 0 0.0.0.0:3307 0.0.0.0: LISTEN 20418/mysqld
Although the toss for a long while, but still very gratified to solve the problem, here need to thank, http://zpz.name/1592/
Provide me with the following reference: Let me Huanran dawu
* * Fix error after compiling mysql: Can ' t change dir to '/var/mysql-dmysql_unix_addr=/var/mysql/mysqld.sock/'
Possible problems and solutions:
1. may be/usr/local/mysql/data/rekfan.pid file does not have permission to write
Workaround: Give permission, execute "chown-r mysql:mysql/var/data" "Chmod-r 755/usr/local/mysql/data" and restart mysqld!
2. The MySQL process may already exist in the process
WORKAROUND: Use the command "Ps-ef|grep mysqld" to see if there is a mysqld process, kill with "kill-9 process number" and then restart mysqld!
3. It may be the second time that MySQL is installed on the machine, with residual data affecting the start of the service.
Workaround: Go to MySQL data directory/data See, if there is mysql-bin.index, quickly delete it, it is the culprit. I am using the third method to solve! http://blog.rekfan.com/?p=186
4.mysql The/ETC/MY.CNF profile is used when the configuration file is not specified at startup, please open this file to see if there is a specified data directory (DATADIR) under the [Mysqld] section.
WORKAROUND: Please set this line under [mysqld]: DataDir =/usr/local/mysql/data
5.skip-federated Field Issues
Workaround: Check the/etc/my.cnf file for any skip-federated fields that have not been commented out, and if so, comment them out immediately.
6. Error log directory does not exist
Workaround: Use "Chown" "chmod" command to give MySQL owner and permissions
7.selinux, if it is a CentOS system, the default is to turn on SELinux
Workaround: Turn it off, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine and try again. **
4 Finally I send the correct multi-instance configuration file:
[Email protected] 3307]# Tree/data
/data
├──3306
│├──data
│├──my.cnf
│└──mysql
└──3307
├──data
├──my.cnf
└──mysql
3306 of MY.CNF
[email protected] 3306]# cat MY.CNF
[Client]
Port = 3306
Socket =/data/3306/mysql.sock
[MySQL]
No-auto-rehash
[Mysqld]
user = MySQL
Port = 3306
Socket =/data/3306/mysql.sock
Basedir =/application/mysql
DataDir =/data/3306/data
Open_files_limit = 1024
Back_log =600
Max_connections = 800
Max_connect_errors = 3000
Table_cache = 614
external-locking = FALSE
Max_allowed_packet = 8M
Sort_buffer_size = 1M
Join_buffer_size = 1M
thread_cache_size = 100
Thread_concurrency = 2
Query_cache_size = 2M
Query_cache_limit = 1M
Query_cache_min_res_unit = 2K
#default_table_type = InnoDB
Thread_stack = 192K
#transaction_isolation = read-committed
Tmp_table_size = 2M
Max_heap_table_size = 2M
Long_query_time = 1
Pid-file =/data/3306/mysql.pid
Relay-log =/data/3306/relay-bin
Relay-log-info-file =/data/3306/relay-log.info
Binlog_cache_size = 1M
Max_binlog_cache_size = 1M
Max_binlog_size = 2M
Key_buffer_size = 16M
Read_buffer_size = 1M
Read_rnd_buffer_size = 1M
Bulk_insert_buffer_size = 1M
Lower_case_table_names = 1
Skip-name-resolve
Slave-skip-errors = 1032,1062
replicate-ignore-db = MySQL
Server-id = 1
Innodb_additional_mem_pool_size = 4M
Innodb_buffer_pool_size = 32M
Innodb_data_file_path = Ibdata1:128m:autoextend
Innodb_file_io_threads = 4
Innodb_thread_concurrency = 8
Innodb_flush_log_at_trx_commit = 2
Innodb_log_buffer_size = 2M
Innodb_log_file_size = 4M
Innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
Innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[Mysqldump]
Quick
Max_allowed_packet = 2M
[Mysqld_safe]
Log-error =/data/3306/mysql_oldboy3306.err
Pid-file =/data/3306/mysqld.pid
3307 my.cnf and 33,061, just change 3306 to 3307, and change server-id=1 to other numbers like, 2,3,4,5, etc.
The MySQL startup file for
3306 is as follows: 3306 of the MySQL boot file is 3306 in the boot file with 3306 modified to 330.
[[email protected] 3306]# cat MySQL
#!/bin/sh
#################################################
#this Scripts is created by Oldboy at 2007-06-09
#oldboy qq:31333741
#site: http://www.etiantian.org
#blog : http://oldboy.blog.51cto.com
#oldboy trainning QQ group:208160987 226199307 44246017
####################### #########################
#init
port=3306
mysql_user= "root"
mysql_pwd= "123456"
cmdpath= "/ Application/mysql/bin "
mysql_sock="/data/${port}/mysql.sock "
#startup function
Function_start_mysql ()
{
If [!-e "$mysql _sock"];then
printf "Starting mysql...\n"
/bin/sh ${cmdpath}/mysqld_safe-- DEFAULTS-FILE=/DATA/${PORT}/MY.CNF 2>&1 >/dev/null &
Else
printf "MySQL is running...\n"
exit
Fi
}
#stop function
Function_stop_mysql ()
{
if [!-e "$mysql _sock"];then
printf "MySQL is stopped...\n"
Exit
Else
printf "stoping mysql...\n"
${cmdpath}/mysqladmin-u ${mysql_user}-p${mysql_pwd}-s/data/${port}/mysql.sock shutdown
Fi
}
#restart function
Function_restart_mysql ()
{
printf "Restarting mysql...\n"
Function_stop_mysql
Sleep 2
Function_start_mysql
}
Case $ in
Start
Function_start_mysql
;;
Stop
Function_stop_mysql
;;
Restart
Function_restart_mysql
;;
*)
printf "Usage:/data/${port}/mysql {start|stop|restart}\n"
Esac
CMake source code compilation Installation mysql-5.5.32: Pits encountered by multiple instances