编译安装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文件不适用的字段,一下是文件内容可供参考:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #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 |
微信

支付宝

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类