編譯安裝mysql5.7.24踩的坑




1、報錯如下:
CMake Error at cmake/boost.cmake:76 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
 
  This CMake script will look for boost in <directory>.  If it is not there,
  it will download and unpack it (in that directory) for you.
 
  If you are inside a firewall, you may need to use an http proxy:
 
  export http_proxy=http://example.com:80
 
Call Stack (most recent call first):
  cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:435 (INCLUDE)
 
 
-- Configuring incomplete, errors occurred!
See also "/byrd/tools/mysql-5.7.9/CMakeFiles/CMakeOutput.log".
解決方法:編譯時添加紅色部分
cmake . -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DDEFAULT_CHARSET=UTF8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DCOMPILATION_COMMENT='dxmysql' \
-DWITH_READLINE=ON \
-DSYSCONFDIR=/mysqldata/3306 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DMYSQL_UNIX_ADDR=/mysqldata/3306/mysql.sock

2、報錯如下:
[root@oracle mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mysqldata/3306/data
2018-11-07T08:41:21.959792Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-11-07T08:41:21.959848Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2018-11-07T08:41:21.961486Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
解決方法:清空數據目錄,再執行初始化命令即可
rm -fr /mysqldata/3306/data/*

3、修改密碼時報錯如下:
(root@localhost) [mysql]> update user set password=password("newpassword") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list
解決方法:mysql5.7.x數據庫下已經沒有password這個字段了,password字段改成了authentication_string,即可
(root@localhost) [mysql]> update mysql.user set authentication_string=password('root') where user='root' ;


4、service mysql start時報錯如下:

[root@pdata-svr115 local]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/mysqldata/3306/mysql.pid).
解決方法:

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字段問題
解決方法:檢查一下my.cnf文件中有沒有沒被注釋掉的skip-federated字段,如果有就立即注釋掉吧。

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

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

我解決的方法是注釋掉my.cnf文件不適用的字段,一下是文件內容可供參考:

#The MySQL client
[client]
port=3306
socket=/mysqldata/3306/mysql.sock
#default-charcter-set=utf8

#The MySQL server
[mysqld]
port=3306
user=mysql
socket=/mysqldata/3306/mysql.sock
pid-file=/mysqldata/3306/mysql.pid
basedir=/usr/local/mysql
datadir=/mysqldata/3306/data
tmpdir=/mysqldata/3306/tmp
open_files_limit=10240
explicit_defaults_for_timestamp

#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=/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
character-set-server=utf8

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

server-id=1
max_connections=1000
wait_timeout=30
interactive_timeout = 30
lower_case_table_names=1
#skip-grant-tables


[mysql]
no-auto-rehash
prompt=(\u@\h) [\d]>\_
#default-character-set=utf8
##character_set_server=utf8

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM