欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

mysql5.7源碼安裝

安裝依賴包
  1. yum -y install gcc gcc-c++ ncurses ncurses-devel cmake

    在工農(nóng)等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站制作、網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作定制開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站制作,成都全網(wǎng)營(yíng)銷,成都外貿(mào)網(wǎng)站建設(shè),工農(nóng)網(wǎng)站建設(shè)費(fèi)用合理。

下載相應(yīng)源碼包
  1. cd /root/oneinstack/src

  2. wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

  3. wget http://cdn.MySQL.com/Downloads/MySQL-5.7/mysql-5.7.11.tar.gz

添加mysql用戶
  1. useradd -M -s /sbin/nologin mysql

預(yù)編譯
  1. tar xzf boost_1_59_0.tar.gz

  2. tar xzf mysql-5.7.11.tar.gz

  3. mkdir -p /data/mysql

  4. cd mysql-5.7.11

  5. cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

  6. -DMYSQL_DATADIR=/data/mysql \

  7. -DDOWNLOAD_BOOST=1 \   #從MySQL 5.7.5開(kāi)始Boost庫(kù)是必需的

  8. -DWITH_BOOST=../boost_1_59_0 \

  9. -DSYSCONFDIR=/etc \

  10. -DWITH_INNOBASE_STORAGE_ENGINE=1 \

  11. -DWITH_PARTITION_STORAGE_ENGINE=1 \

  12. -DWITH_FEDERATED_STORAGE_ENGINE=1 \

  13. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

  14. -DWITH_MYISAM_STORAGE_ENGINE=1 \

  15. -DENABLED_LOCAL_INFILE=1 \

  16. -DENABLE_DTRACE=0 \

  17. -DDEFAULT_CHARSET=utf8mb4 \

  18. -DDEFAULT_COLLATION=utf8mb4_general_ci \

  19. -DWITH_EMBEDDED_SERVER=1

cmake . -DCMAKE_INSTALL_PREFIX=/srv/mysql5713 \

-DMYSQL_DATADIR=/srv/mysql5713/data \

-DMYSQL_UNIX_ADDR=/srv/mysql5713/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_FEDERATER_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_EXAMPLE_STORAGE_ENGINE=1 \

-DWITH_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 \

-DWITH_BOOST=/srv/mysql/boost_1_59_0

編譯安裝

   make

   make install

啟動(dòng)腳本,設(shè)置開(kāi)機(jī)自啟動(dòng)
  1. /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

  2. chmod +x /etc/init.d/mysqld

  3. chkconfig --add mysqld

  4. chkconfig mysqld on

/etc/my.cnf,僅供參考
  1. vim /etc/my.cnf

  2. [client]

  3. port = 3306

  4. socket = /tmp/mysql.sock

  5. default-character-set = utf8mb4

  6. [mysqld]

  7. port = 3306

  8. socket = /tmp/mysql.sock

  9. basedir = /usr/local/mysql

  10. datadir = /data/mysql

  11. pid-file = /data/mysql/mysql.pid

  12. user = mysql

  13. bind-address = 0.0.0.0

  14. server-id = 1

  15. init-connect = 'SET NAMES utf8mb4'

  16. character-set-server = utf8mb4

  17. #skip-name-resolve

  18. #skip-networking

  19. back_log = 300

  20. max_connections = 1000

  21. max_connect_errors = 6000

  22. open_files_limit = 65535

  23. table_open_cache = 128

  24. max_allowed_packet = 4M

  25. binlog_cache_size = 1M

  26. max_heap_table_size = 8M

  27. tmp_table_size = 16M

  28. read_buffer_size = 2M

  29. read_rnd_buffer_size = 8M

  30. sort_buffer_size = 8M

  31. join_buffer_size = 8M

  32. key_buffer_size = 4M

  33. thread_cache_size = 8

  34. query_cache_type = 1

  35. query_cache_size = 8M

  36. query_cache_limit = 2M

  37. ft_min_word_len = 4

  38. log_bin = mysql-bin

  39. binlog_format = mixed

  40. expire_logs_days = 30

  41. log_error = /data/mysql/mysql-error.log

  42. slow_query_log = 1

  43. long_query_time = 1

  44. slow_query_log_file = /data/mysql/mysql-slow.log

  45. performance_schema = 0

  46. explicit_defaults_for_timestamp

  47. #lower_case_table_names = 1

  48. skip-external-locking

  49. default_storage_engine = InnoDB

  50. #default-storage-engine = MyISAM

  51. innodb_file_per_table = 1

  52. innodb_open_files = 500

  53. innodb_buffer_pool_size = 64M

  54. innodb_write_io_threads = 4

  55. innodb_read_io_threads = 4

  56. innodb_thread_concurrency = 0

  57. innodb_purge_threads = 1

  58. innodb_flush_log_at_trx_commit = 2

  59. innodb_log_buffer_size = 2M

  60. innodb_log_file_size = 32M

  61. innodb_log_files_in_group = 3

  62. innodb_max_dirty_pages_pct = 90

  63. innodb_lock_wait_timeout = 120

  64. bulk_insert_buffer_size = 8M

  65. myisam_sort_buffer_size = 8M

  66. myisam_max_sort_file_size = 10G

  67. myisam_repair_threads = 1

  68. interactive_timeout = 28800

  69. wait_timeout = 28800

  70. [mysqldump]

  71. quick

  72. max_allowed_packet = 16M

  73. [myisamchk]

  74. key_buffer_size = 8M

  75. sort_buffer_size = 8M

  76. read_buffer = 4M

  77. write_buffer = 4M

  78. EOF

初始化數(shù)據(jù)庫(kù)
  1. 之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目錄下,且已被廢棄

  2. "--initialize"會(huì)生成一個(gè)隨機(jī)密碼(~/.mysql_secret),而"--initialize-insecure"不會(huì)生成密碼

  3. --datadir目標(biāo)目錄下不能有數(shù)據(jù)文件

  4. /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

啟動(dòng)數(shù)據(jù)庫(kù)

  cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

  service mysql start

 chkconfig mysql on

設(shè)置數(shù)據(jù)庫(kù)密碼
  1. dbrootpwd=oneinstack  #數(shù)據(jù)庫(kù)root密碼

  2. /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;"

  3. /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;"

  4. 新版的mysql數(shù)據(jù)庫(kù)下的user表中已經(jīng)沒(méi)有Password字段了,而是將加密后的用戶密碼存儲(chǔ)于authentication_string字段 

安裝

1> 添加mysql用戶

shell> cd /opt/mysql-server
shell> groupadd mysql #添加mysql用戶組
shell> useradd -r -g mysql -s /bin/false mysql #添加mysql用戶

2> 配置mysql預(yù)編譯參數(shù)

shell> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=/usr/local/boost_1_59_0 \
-DSYSCONFDIR=/etc \
-DEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all
  • -DCMAKE_INSTALL_PREFIX:安裝路徑

  • -DMYSQL_DATADIR:數(shù)據(jù)存放目錄

  • -DWITH_BOOST:boost源碼路徑

  • -DSYSCONFDIR:my.cnf配置文件目錄

  • -DEFAULT_CHARSET:數(shù)據(jù)庫(kù)默認(rèn)字符編碼

  • -DDEFAULT_COLLATION:默認(rèn)排序規(guī)則

  • -DENABLED_LOCAL_INFILE:允許從本文件導(dǎo)入數(shù)據(jù)

  • -DEXTRA_CHARSETS:安裝所有字符集

更多預(yù)編譯配置參數(shù)請(qǐng)參考mysql官方文檔說(shuō)明:http://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html#cmake-general-options

3> 編譯并安裝

shell> make -j `grep processor /proc/cpuinfo | wc -l`shell> make install

-j參數(shù)表示根據(jù)CPU核數(shù)指定編譯時(shí)的線程數(shù),可以加快編譯速度。默認(rèn)為1個(gè)線程編譯,經(jīng)測(cè)試單核CPU,1G的內(nèi)存,編譯完需要將近1個(gè)小時(shí)。

4> 初始化系統(tǒng)數(shù)據(jù)庫(kù)

shell> cd /usr/local/mysql
shell> chown -R mysql:mysql .
# 注意:MySQL 5.7.6之前的版本執(zhí)行這個(gè)腳本初始化系統(tǒng)數(shù)據(jù)庫(kù)
shell> ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# 5.7.6之后版本初始系統(tǒng)數(shù)據(jù)庫(kù)腳本(本文使用此方式初始化)
shell> ./bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
shell> ./bin/mysql_ssl_rsa_setup
shell> chown -R root .
shell> chown -R mysql data

5、設(shè)置配置文件

shell> cp support-files/my-default.cnf /etc/my.cnf

6、配置mysql服務(wù)

shell> cp support-files/mysql.server /etc/init.d/mysqld
shell> chkconfig --add mysqld     # 添加到系統(tǒng)服務(wù)
shell> chkconfig mysqld on        # 開(kāi)機(jī)啟動(dòng)

7、啟動(dòng)服務(wù)

shell> service mysqld start       # 啟動(dòng)mysql服務(wù)
shell> service mysqld stop        # 停止mysql服務(wù)
shell> service mysqld restart     # 重新啟動(dòng)mysql服務(wù)

8、設(shè)置數(shù)據(jù)庫(kù)密碼

shell> /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by "root" with grant option;"
shell> /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by "root" with grant option;"# 開(kāi)啟遠(yuǎn)程登錄(將host設(shè)為%即可)/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'%' identified by "root" with grant option;"

9、配置mysql環(huán)境變量

shell> vim /etc/profile
shell> export PATH=/usr/local/mysql/bin:$PATH
shell> source /etc/profile

其它注意事項(xiàng)

如果中途編譯失敗了,需要?jiǎng)h除cmake生成的預(yù)編譯配置參數(shù)的緩存文件和make編譯后生成的文件,再重新編譯。

shell> cd /opt/mysql-server
shell> rm -f CMakeCache.txt
shell> make clean

名稱欄目:mysql5.7源碼安裝
網(wǎng)站鏈接:http://www.chinadenli.net/article14/jigede.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷型網(wǎng)站建設(shè)品牌網(wǎng)站建設(shè)動(dòng)態(tài)網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)公司網(wǎng)站策劃靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)