博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL编译安装时常见错误分析
阅读量:6955 次
发布时间:2019-06-27

本文共 4586 字,大约阅读时间需要 15 分钟。

hot3.png

1 没有安装MySQL所需要的boost库

测试发现编译MySQL5.7以及更高的版本时,都需要下载并引用或者直接安装boost库,否则在执行cmake命令时会报如下错误:

-- Running cmake version 3.2.1-- Configuring with MAX_INDEXES = 64U-- SIZEOF_VOIDP 8-- MySQL 5.7.6-m16          [MySQL版本]-- Packaging as: mysql-5.7.6-m16-Linux-x86_64-- Looked for boost/version.hpp in  and -- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND-- LOCAL_BOOST_DIR -- LOCAL_BOOST_ZIP -- Could not find (the correct version of) boost.       [关键错误信息]-- MySQL currently requires boost_1_57_0                    [解决办法]CMake Error at cmake/boost.cmake:76 (MESSAGE):          [具体错误和解决方法]  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=
This CMake script will look for boost in
. 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:80Call Stack (most recent call first): cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST) CMakeLists.txt:452 (INCLUDE)-- Configuring incomplete, errors occurred!See also "/mydata/mysql-5.7.6-m16/CMakeFiles/CMakeOutput.log".

解决方法:先下载Boost库,然后通过在cmake命令后面添加参数-DDOWNLOAD_BOOST=1 -DWITH_BOOST=Boost库路径即可。

2 执行cmake时缺少Ncurses库的支持

Ncurses提供功能键定义(快捷键),屏幕绘制以及基于文本终端的图形互动功能的动态库。

[root@typecodes ~]# yum -y install ncurses-devel-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:64 (MESSAGE):  Curses library not found.  Please install appropriate package,      remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.Call Stack (most recent call first):  cmake/readline.cmake:107 (FIND_CURSES)  cmake/readline.cmake:181 (MYSQL_USE_BUNDLED_EDITLINE)  CMakeLists.txt:480 (MYSQL_CHECK_EDITLINE)-- Configuring incomplete, errors occurred!See also "/mydata/mysql-5.7.6-m16/CMakeFiles/CMakeOutput.log".See also "/mydata/mysql-5.7.6-m16/CMakeFiles/CMakeError.log".

解决方法:直接执行命令yum -y install ncurses-devel安装Ncurses即可。

3 安装MySQL完后,无法正常启动服务

在安装完MySQL后,执行命令service mysqld start失败,也即无法正常启动MySQL服务。

无法正常启动MySQL服务

解决方法:主要通过命令systemctl status mysqld.service和MySQL的日志来分析。如上图所示,在日志文件/var/log/mysql/error.log中可以看到具体的ERROR信息:Could not create unix socket lock file /var/run/mysql/mysql.sock.lock。这种错误一般都是目录不存在或者权限不足,所以我们直接使用命令mkdir -p /var/log/mysql/创建该目录即可,然后可以设置目录权限chown -R mysql:mysql /var/log/mysql/

备注:这个问题,网上这个兄弟并没有完全解决,但是说对一点,确实是目录权限的问题,是安装目录需要设置chown -R mysql:mysql /usr/local/mysql/

4 操作MySQL时,报错You must SET PASSWORD before executing this statement

用MySQL的root用户登录数据库后,如果之前没有设置密码,那么执行任何操作命令时,会提示如下错误信息。

mysql> CREATE DATABASE `testmysqldatabase` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

常规的使用MySQL安全模式的解决方法如下,但是在MySQL5.7以及更高版本下是行不通的。

[root@typecodes ~]# service mysqld stopShutting down MySQL..[  OK  ][root@typecodes ~]# /mydata/mysql/bin/mysqld_safe --user=mysql --skip-networking --skip-grant-tables &[1] 3688[root@typecodes ~]# 150409 23:02:02 mysqld_safe Logging to '/var/log/mysql/error.log'.150409 23:02:02 mysqld_safe Starting mysqld daemon with databases from /mydata/mysql/data######重新登录mysql后,设置root密码mysql> set password='this is a password sample';ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

有效的解决方法:

[root@typecodes ~]# mysql -u root -p            [使用root用户登录]Enter password:                             [无密码,直接回车]Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.6-m16Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> select * from mysql.user;ERROR 1820 (HY000): You must SET PASSWORD before executing this statementmysql> set password='this is a password sample';ERROR 1819 (HY000): Your password does not satisfy the current policy requirements######设置当前root用户密码mysql> set password='your password';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)

需要说明的是,修改用户密码的SQL语句在不同的MySQL版本中是不同的。下面这3种是MySQL5.5以下的版本的修改方法,但是不适用于MySQL5.7以及更高版本。

mysql> update mysql.user set PASSWORD='your password' where User='root';mysql> SET PASSWORD for root@'localhost' = PASSWORD('your password');mysql> SET PASSWORD = PASSWORD('your password');

转载于:https://my.oschina.net/u/1429136/blog/877853

你可能感兴趣的文章
CDH5.15安装
查看>>
调和级数求和
查看>>
我的友情链接
查看>>
雪花效果
查看>>
Windows下实现MySql主从复制
查看>>
2013年度IT博客大赛50强获奖感言
查看>>
Vmware VsPhere下的linux OS安装Vmware Tools
查看>>
Linux下安装jdk8步骤详述
查看>>
IE6是真正的公敌吗与够用就行
查看>>
memcpy函数
查看>>
Spring Schedule
查看>>
从智能电视开始,PPTV与Letv全线开战?
查看>>
ps切图技巧
查看>>
outlook 2007 or 2010 的OLK 4文件夹在WIN 7系统存放在哪儿?
查看>>
centos 单用户登录(无法启动 问题处理)
查看>>
python的时间比较
查看>>
设计数据结构SetOfStacks, 由多个栈组成,并且在前一个栈填满时新建一个栈
查看>>
查看mysql版本和字符编码
查看>>
Win7 & Win XP安装小米驱动
查看>>
主元素
查看>>