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