1. 程式人生 > >mysql-boost-5.7.17安裝

mysql-boost-5.7.17安裝

tab har .so down enc roo esp other repeat

1、下載源碼包
#wget?https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.17.tar.gz
2、進入解壓目錄

cd mysql-5.7.17

3、安裝相關依賴
[root@safehourse69 mysql-5.7.17]# yum install -y cmake gcc-c++* make ncurses-devel
2、4、創建mysql運行用戶
[root@safehourse69 mysql-5.7.18]# useradd -M -s /sbin/nologin mysql
5、執行源碼編譯
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL-USER=mysql -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost

3、編譯之後,下面就是安裝了,執行如下命令
#make -j 4 && make install
在編譯的時候,如果虛擬機或是機器配置過低會報如下錯誤,建議配置為4核4G的配置來安裝,我的安裝是卡到75%這裏,然後就不動了
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs"
調整完配置之後,再執行上面的安裝命令
#make -j 4 && make install
7、更改文件夾屬主和屬組

chown -R mysql.mysql /usr/local/mysql/

8、手動添加編輯配置文件
[root@safehourse69 mysql-5.7.18]# cd /usr/local/mysql/support-files/
[root@safehourse69 support-files]# vim my-default.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /tmp/mysql.sock
character-set-server=utf8
back_log = 300

max_connections = 3000
max_connect_errors = 50
table_open_cache = 4096
max_allowed_packet = 32M
#binlog_cache_size = 4M
max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
#log-bin=mysql-bin
long_query_time = 6
server_id=1
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 16
innodb_log_buffer_size = 16M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
[mysqldump]
quick
max_allowed_packet = 32M
[mysql]
no-auto-rehash
default-character-set=utf8
safe-updates
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
[client]
9、初始化mysql服務

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

10、復制配置文件

cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

11、復制啟動腳本

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

12、修改啟動腳本,在下面這個位置後面寫上安裝路徑

vim /etc/init.d/mysqld

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

13、啟動mysql 服務

cd /usr/local/mysql/bin/

./mysqld_safe --user=mysql &

service mysqld restart

Shutting down MySQL. SUCCESS!?
Starting MySQL. SUCCESS!?

14 做軟連接,讓系統直接調用

ln -s /usr/local/mysql/bin/* /bin/

15、登錄數據庫報如下錯誤,卡到這裏了
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)

系統沒有找到mysql.sock文件

這裏查看配置文件裏寫的是mysqld.sock??把配置文件裏的mysqld.sock改成mysql.sock重啟mysql 服務,就可以登錄了

默認沒有密碼直接登錄的

mysql

Welcome to the MySQL monitor.??Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>

16、登錄數據庫修改密碼
mysql> SET PASSWORD = PASSWORD(‘Xinwangai7/‘);
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

測試用新密碼登錄

mysql -u root -p

Enter password:?
Welcome to the MySQL monitor.??Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18 Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>?

mysql-boost-5.7.17安裝