中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

cmake源碼編譯安裝mysql-5.5.32:多實例遇到的坑

發布時間:2020-08-11 23:24:15 來源:網絡 閱讀:2409 作者:sandshell 欄目:MySQL數據庫

坑1:找不到mysql-5.5.32.tar.gz 源碼包
費勁了很多力氣才找到:
mysql 源碼包下載地址:
https://downloads.mysql.com/archives/community/

下載路徑
https://downloads.mysql.com/archives/get/file/mysql-5.5.32.tar.gz
授人以魚,我是怎么找到的?

cmake源碼編譯安裝mysql-5.5.32:多實例遇到的坑

坑2:cmake配置報錯因為\后面有空格導致的,cmake編譯參數正確的為如下:
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

坑3:mysql多實例執行啟動后,端口沒有啟動,查看日志發現報錯。
[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

關鍵報錯日志點為:
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)

經過仔細檢查是因為多實例配置文件中把datadir路徑指向了/application/3306/data導致的。
3307實例報錯也是一樣的。
修改3306和3307多實例my.cnf中的datadir= /data/3307/data 后再啟動兩個實例后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

雖然折騰了半天,但是仍很欣慰解決了問題,這里需要感謝一下,http://zpz.name/1592/
給我提供如下參考:讓我煥然大悟

**解決編譯MySQL后的錯誤:Can’t change dir to ‘/var/mysql-DMYSQL_UNIX_ADDR=/var/mysql/mysqld.sock/’
一下時可能的問題和解決方案:

1.可能是/usr/local/mysql/data/rekfan.pid文件沒有寫的權限
解決方法 :給予權限,執行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新啟動mysqld!

2.可能進程里已經存在mysql進程
解決方法:用命令“ps -ef|grep mysqld”查看是否有mysqld進程,如果有使用“kill -9 進程號”殺死,然后重新啟動mysqld!

3.可能是第二次在機器上安裝mysql,有殘余數據影響了服務的啟動。
解決方法:去mysql的數據目錄/data看看,如果存在mysql-bin.index,就趕快把它刪除掉吧,它就是罪魁禍首了。本人就是使用第三條方法解決的 !http://blog.rekfan.com/?p=186

4.mysql在啟動時沒有指定配置文件時會使用/etc/my.cnf配置文件,請打開這個文件查看在[mysqld]節下有沒有指定數據目錄(datadir)。
解決方法:請在[mysqld]下設置這一行:datadir = /usr/local/mysql/data

5.skip-federated字段問題
解決方法:檢查一下/etc/my.cnf文件中有沒有沒被注釋掉的skip-federated字段,如果有就立即注釋掉吧。

6.錯誤日志目錄不存在
解決方法:使用“chown” “chmod”命令賦予mysql所有者及權限

7.selinux惹的禍,如果是centos系統,默認會開啟selinux
解決方法:關閉它,打開/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled后存盤退出重啟機器試試。**

4 最后我把正確的多實例的配置文件發一下:
[root@db02 3307]# tree /data
/data
├── 3306
│ ├── data
│ ├── my.cnf
│ └── mysql
└── 3307
├── data
├── my.cnf
└── mysql
3306的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 = 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和3306一樣,只是把3306修改為3307,并且把server-id=1修改為其他數字比如,2,3,4,5等等

3306的mysql啟動文件如下:3306的mysql啟動文件就是把3306中的啟動文件中帶3306修改為330即可。
[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

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

长春市| 石渠县| 墨玉县| 阿图什市| 宽城| 邓州市| 兴安盟| 乐都县| 洛阳市| 尉犁县| 平和县| 资中县| 镇安县| 锡林郭勒盟| 建阳市| 大埔县| 连山| 古交市| 海门市| 文昌市| 囊谦县| 葵青区| 定边县| 高雄市| 开平市| 德化县| 珲春市| 老河口市| 松江区| 高平市| 塔城市| 宜昌市| 南皮县| 凯里市| 苏尼特左旗| 武安市| 会同县| 彭水| 海宁市| 南丹县| 西乡县|