您好,登錄后才能下訂單哦!
這篇文章主要介紹“怎么用源碼安裝mysql5.6.37”,在日常操作中,相信很多人在怎么用源碼安裝mysql5.6.37問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么用源碼安裝mysql5.6.37”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
MYSQL 源碼安裝:
修改參數文件:
vi /etc/security/limits.conf
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 1024
mysql hard nofile 65536
下載5.6.37源碼
解壓后用cmake安裝:
cmake . -DCMAKE_INSTALL_PREEIX=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWICH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PREFSCHEMA_STORAGE_ENGINE=1 \
-DCOMPILATION_COMMENT='JSS for mysqltest' \
-DWITH_READLINE=ON \
-DSYSCONFDIR=/data/mysqldata/3306 \
-DMYSQL_UNIX_ADDR=/data/mysqldata/3306/mysql.sock
編譯稱重后安裝
make && make install
chown -R mysql:mysql /usr/local/mysql
export LANG=zh_CN.CB18030
export PATH=/usr/local/mysql/bin:$PATH
cd /data/
mkdir -p /data/mysqldata/{3306/{data,tmp,binlog},backup,scripts}
chown -R mysql:mysql mysqldata
su - mysql
cd /usr/local/mysql
編輯參數文件
/data/mysqldata/3306/my.cnf
[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock
#The MySQL server
[mysqld]
port =3306
user =mysql
socket =/data/mysqldata/3306/mysql.sock
pid-file=/data/mysqldata/3306/mysql.pid
basedir =/usr/local/mysql
datadir =/data/mysqldata/3306/data
tmpdir =/data/mysqldata/3306/tmp
open_files_limit =10240
explicit_defaults_for_timestamp
sql_mode =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#Buffer
max_allowed_packet =256m
max_heap_table_size =256m
net_buffer_length =8k
sort_buffer_size =2m
join_buffer_size =4m
read_buffer_size =2m
read_rnd_buffer_size =16m
#Log
log-bin =/data/mysqldata/3306/binlog/mysql-bin
binlog_cache_size =32m
max_binlog_cache_size =512m
max_binlog_size =512m
binlog_format =mixed
log_output =FILE
log-error =../mysql-error.log
slow_query_log =1
slow_query_log_file =../slow_query.log
general_log =0
general_log_file =../general_query.log
expire-logs-days =14
#InnoDB
innodb_data_file_path =ibdata1:2048m:autoextend
innodb_log_file_size =256m
innodb_log_files_in_group =3
innodb_buffer_pool_size =1024m
[mysql]
no-auto-rehash
prompt =(\u@\h) [\d]>\_
default-character-set=gbk
初始化db
/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql
此處因為參數文件手敲,出現了錯誤,需要重新初始化,步驟為:
1 刪除/usr/local/mysql/my.cnf
2 刪除/data/mysqldata/3306下除了my.cnf外的所有文件,并重新創建此目錄下的binlog,data,tmp目錄
3 重新運行初始化腳本
啟動mysql
mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &
netstat -lnt|grep 3306
ps -ef|grep bin/mysql|grep -v grep
設置管理員用戶與密碼:
mysql
select user,host from mysql.user ;
delete from mysql.user where (user,host) not in (select 'root','localhost');
update mysql.user set user='system',password=password('xxxxxxxxx');
truncate table mysql.db;
flush privileges;
這樣就安全了。
到此,關于“怎么用源碼安裝mysql5.6.37”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。