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

溫馨提示×

溫馨提示×

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

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

源碼安裝mysql5.6.38測試及教程

發布時間:2020-04-21 14:49:21 來源:億速云 閱讀:217 作者:三月 欄目:MySQL數據庫

下文給大家帶來源碼安裝mysql5.6.38測試及教程,希望能夠給大家在實際運用中帶來一定的幫助,MYSQL涉及的東西比較多,理論也不多,網上有很多書籍,今天我們就用億速云在行業內累計的經驗做一個解答。

1、環境centos7 x64
CentOS Linux release 7.4.1708 (Core) 關閉selinux
下載 https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.38.tar.gz
yum install gcc gcc-c++ ncurses-devel cmake  libaio bison perl-Module-Install.noarch -y
2、權限
建立用戶
#useradd -r -g mysql -s /sbin/nologin -M mysql
數據庫存放目錄設置成mysql用戶mysql組
mkdir -p /data/mysqldata/3306用來存放數據庫并賦予權限
chown -R mysql.mysql /data/mysqldata/3306
3、編譯mysql5.6.38.tar.gz,解壓 tar zxvf mysql5.6.38.tar.gz
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql3306 -DMYSQL_DATADIR=/data/mysqldata/3306 -DSYSCONFDIR=/usr/local/mysql3306/etc -DMYSQL_UNIX_ADDR=/usr/local/mysql3306/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
然后執行
make && make install

源碼安裝mysql5.6.38測試及教程

4、編譯完成配置mysql服務權限
# cd /usr/local/mysql3306
# chown -R mysql:mysql .
# mkdir -p /data/mysql
# mkdir -p /usr/local/mysql3306/etc
# chown mysql.mysql -R /data
# chmod 775 -R /data

scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql3306 --datadir=/data/mysqldata/3306/
和配置my.cnf 保持一致
#### chown -R root:mysql . (將權限設置給root用戶,并設置給mysql組, 取消其他用戶的讀寫執行權限,僅留給mysql "rx"讀執行權限,其他用戶無任何權限)
## chown -R mysql:mysql ./data (數據庫存放目錄設置成mysql用戶mysql組)
## chmod -R ug+rwx . (賦予讀寫執行權限,其他用戶權限一律刪除僅給mysql用戶權限)

# cp support-files/my-default.cnf /usr/local/mysql3306/etc/my.cnf (可以放在/etc/my.cnf)
修改my.cnf配置,先使用簡單配置,測試數據庫正常后,再增加優化配置
# vi /etc/my.cnf
#[mysqld] 下面添加:
vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql3306
datadir=/data/mysqldata/3306
port=3306
socket=/data/mysqldata/3306/mysql.sock
server_id=1
[mysqld_safe]
log-error=/data/mysqldata/3306/log/mysqld.log
備注修改 datadir=/data/mysqldata/3306 需要在 scripts/mysql_install_db --user=mysql 添加 --datadir=/data/mysqldata/3306
5、 啟動mysql
# bin/mysqld_safe --user=mysql &
看是否成功
# ps –ef|grep mysql**

將mysql的啟動服務添加到系統服務中
# cp support-files/mysql.server /etc/init.d/mysql3306
現在可以使用下面的命令啟動mysql
# service mysql3306 start
停止mysql服務
# service mysql3306 stop
重啟mysql服務
# service mysql3306 restart

6、修改root用戶密碼
# cd /usr/local/mysql3306
# ./bin/mysqladmin -u root password
New password:
Confirm new password:
回車在接下來的提示中設置新密碼即可。。
# service mysql3306 restart; (重啟mysql云服務器)

7、登錄mysql測試
#cd
#vim .bash_profile
修改.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql3306/bin
然后source .bash_profile
#mysql -uroot -p
mysql> use mysql;
mysql> select host,user from mysql.user;

8、我這生產環境下my.cnf配置
#
##mysql configure file my.cnf
#
[client]
port    = 3306
socket  = /usr/local/mysql3306/mysql.sock

[mysql]
prompt="\u@mysqldb \R:\m:\s [\d]> "
no-auto-rehash

[mysqld]
user    = mysql
port    = 3306
basedir = /usr/local/mysql3306
datadir = /data/mysqldata/3306
socket  = /usr/local/mysql3306/mysql.sock
pid-file = /data/mysqldata/datasql-2.pid
character-set-server = utf8
lower_case_table_names=1
skip_name_resolve = 1
open_files_limit    = 65535
back_log = 1024
max_connections = 2000
max_connect_errors = 1000000
table_definition_cache = 1024
table_open_cache_instances = 64
thread_stack = 512K
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 4M
join_buffer_size = 4M
thread_cache_size = 3000
query_cache_size = 0
query_cache_type = 0
interactive_timeout = 600
wait_timeout = 600
tmp_table_size = 32M
max_heap_table_size = 32M
slow_query_log = 1
slow_query_log_file = /data/mysqldata/3306/log/slow.log
log-error = /data/mysqldata/3306/log/mysqld.log
long_query_time = 0.1
log_queries_not_using_indexes =1
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = 1
log_slow_slave_statements = 1
server-id = 43   #主從復制加上次參數,數值可以按IP末尾數,也可以其他值
log-bin = mysql-bin  #主從復制加上次參數
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
expire_logs_days = 7
master_info_repository = TABLE
relay_log_info_repository = TABLE
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = row
relay_log_recovery = 1
relay-log-purge = 1
key_buffer_size = 32M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
lock_wait_timeout = 3600
explicit_defaults_for_timestamp = 1
innodb_thread_concurrency = 0
innodb_sync_spin_loops = 100
innodb_spin_wait_delay = 30

log_bin_trust_function_creators = 1
transaction_isolation = REPEATABLE-READ

innodb_buffer_pool_size = 91750M   #參考服務器內存情況,按內存的80%填寫
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1

innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2

# 根據您的服務器IOPS能力適當調整
# 普通SSD盤的話,可以調整到 10000 - 20000
#高端PCIe SSD卡的話,調整的更高,比如 50000 - 80000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_flush_neighbors = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4

innodb_open_files = 65535
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32

innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_online_alter_log_max_size = 4G

innodb_stats_on_metadata = 0

innodb_status_file = 1
# 開啟 innodb_status_output & innodb_status_output_locks , 可能會導致log-error文件增長較快
innodb_status_output = 0
innodb_status_output_locks = 0

#performance_schema
performance_schema = 1
performance_schema_instrument = '%=on'

#innodb monitor
innodb_monitor_enable="module_innodb"
innodb_monitor_enable="module_server"
innodb_monitor_enable="module_dml"
innodb_monitor_enable="module_ddl"
innodb_monitor_enable="module_trx"
innodb_monitor_enable="module_os"
innodb_monitor_enable="module_purge"
innodb_monitor_enable="module_log"
innodb_monitor_enable="module_lock"
innodb_monitor_enable="module_buffer"
innodb_monitor_enable="module_index"
innodb_monitor_enable="module_ibuf_system"
innodb_monitor_enable="module_buffer_page"
innodb_monitor_enable="module_adaptive_hash"

[mysqldump]
quick
max_allowed_packet = 32M
[mysqld_safe]
log-error = /data/mysqldata/3306/log/mysqld.log
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

看了以上關于源碼安裝mysql5.6.38測試及教程,如果大家還有什么地方需要了解的可以在億速云行業資訊里查找自己感興趣的或者找我們的專業技術工程師解答的,億速云技術工程師在行業內擁有十幾年的經驗了。

 

 

向AI問一下細節

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

AI

伊宁县| 余庆县| 北宁市| 兴山县| 台湾省| 池州市| 定远县| 齐河县| 平远县| 上林县| 永川市| 古浪县| 苗栗市| 平南县| 海南省| 无棣县| 芦溪县| 嘉善县| 嘉荫县| 安塞县| 康马县| 葵青区| 屏山县| 平邑县| 昭苏县| 五莲县| 乌兰县| 耒阳市| 静宁县| 出国| 长丰县| 兴业县| 博客| 体育| 霍林郭勒市| 龙陵县| 健康| 贵南县| 城步| 盐津县| 桂东县|