Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cmake source code compilation and installation mysql-5.5.32: a pit encountered by multiple instances

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Pit 1: mysql-5.5.32.tar.gz source code package not found

It took a lot of effort to find:

Download address of mysql source package:

Https://downloads.mysql.com/archives/community/

Download path

Https://downloads.mysql.com/archives/get/file/mysql-5.5.32.tar.gz

Teach people to fish, how did I find it?

If an error is reported in the pit 2:cmake configuration because there is a space after\, the correct cmake compilation parameters are as follows:

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

After the multi-instance execution of 3:mysql is started, the port is not started. Check the log and find that an error has been reported.

[root@db02 3306] # / data/3306/mysql start

Starting MySQL...

[root@db02 3306] # / data/3307/mysql start

Starting MySQL...

[root@db02 3306] # netstat-lntup | grep 330

[root@db02 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

The 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)

It is carefully checked because the datadir path points to / application/3306/data in the multi-instance configuration file.

The same is true for 3307 instance error reports.

Modify datadir= / data/3307/data in 3306 and 3307 multi-instance my.cnf, and then start two instances after ok

[root@db02 3306] # / data/3306/mysql start

Starting MySQL...

[root@db02 3306] # / data/3307/mysql start

Starting MySQL...

[root@db02 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 I have been tossing around for a long time, I am still glad to have solved the problem. I need to thank you here, http://zpz.name/1592/.

Provide me with the following reference: make me feel enlightened

* * resolve the error after compiling MySQL: Can't change dir to'/ var/mysql-DMYSQL_UNIX_ADDR=/var/mysql/mysqld.sock/'

Possible problems and solutions:

1. It may be that / usr/local/mysql/data/rekfan.pid file does not have write permission

Solution: give permission, execute "chown-R mysql:mysql / var/data"chmod-R 755 / usr/local/mysql/data" and then restart mysqld!

two。 The mysql process may already exist in the process.

Solution: use the command "ps-ef | grep mysqld" to see if there are any mysqld processes, and if so, use the "kill-9 process number" to kill, and then restart mysqld!

3. This may be the second time that mysql is installed on the machine, and there is residual data that affects the startup of the service.

Solution: go to mysql's data directory / data. If mysql-bin.index exists, delete it as soon as possible. It's the culprit. I use the third method to solve the problem! Http://blog.rekfan.com/?p=186

4.mysql will use the / etc/my.cnf configuration file when it starts without specifying a configuration file. Please open this file to see if there is a data directory (datadir) specified under the [mysqld] section.

Solution: please set this line under [mysqld]: datadir = / usr/local/mysql/data

5.skip-federated field problem

Solution: check the / etc/my.cnf file to see if there are any skip-federated fields that have not been commented out, and if so, comment them out immediately.

6. Error log directory does not exist

Solution: use the "chown"chmod" command to give the mysql owner and permissions

7.selinux caused the disaster. If it is centos system, selinux will be enabled by default.

Solution: close it, open / etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, then save and exit and restart the machine. **

4 finally, I will send the correct multi-instance configuration file:

[root@db02 3307] # tree / data

/ data

├── 3306

│ ├── data

│ ├── my.cnf

│ └── mysql

└── 3307

├── data

├── my.cnf

└── mysql

3306 of my.cnf

[root@db02 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 = 19K

# 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 and 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

The my.cnf of 3307 is the same as 3306, except that 3306 is changed to 3307, and server-id=1 is changed to other numbers such as, 2, 2, 3, 4, 5, and so on.

The mysql startup file of 3306 is as follows: the mysql startup file of 3306 is to modify the startup file with 3306 in 3306.

[root@db02 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 $1 in

Start)

Function_start_mysql

Stop)

Function_stop_mysql

Restart)

Function_restart_mysql

*)

Printf "Usage: / data/$ {port} / mysql {start | stop | restart}\ n"

Esac

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report