CentOS6.8安装编译mysql5.6

前端之家收集整理的这篇文章主要介绍了CentOS6.8安装编译mysql5.6前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. 安装gcc

yuminstallgccgcc-c++ncurses-develperl

2. 下载源码包(一定要是source类型的,要不然从cmake就会出错)


3. 解压后进入MysqL目录

4.cmake编译配置(会出错误

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/MysqL \
-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='JSS for MysqLtest' \
-DWITH_READLINE=ON \
-DSYSCONFDIR=/data/MysqLdata/3306 \
-DMysqL_UNIX_ADDR=/data/MysqLdata/3306/MysqL.sock

5.出错

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at @H_301_49@cmake/readline.cmake:85 (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):
@H_301_49@ cmake/readline.cmake:128 (FIND_CURSES)
cmake/readline.cmake:202 (MysqL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:421 (MysqL_CHECK_EDITLINE)

-- Configuring incomplete,errors occurred!
See also "/soft/MysqL-5.6.30/CMakeFiles/CMakeOutput.log".
See also "/soft/MysqL-5.6.30/CMakeFiles/CMakeError.log".

6.解决错误需要安装缺失包

yum install ncurses-devel

7.重新删除配置文件
rm -rf CMakeCache.txt

8. 重新执行第4步

9. make && make install(如果出错,可能是因为没有权限,要分开用sudo执行)

*****************************************

启动MysqL

  1. cpsupport-files/MysqL.server/etc/init.d/MysqLd
  2. vim/etc/profile
  3. PATH=/usr/local/MysqL/bin:/usr/local/MysqL/lib:$PATH
  4. exportPATH
  5. source/etc/profile
还要对log,pid,data等目录做chown设置
(上面的配置可以让MysqL通过service MysqLd start启动)

@H_301_49@首次登录修改root密码
MysqLd --skip-grant-tables,这个命令会出现警告之类的,不用管,在新窗口中登录MysqL
执行命令:update MysqL.user set password=PASSWORD('root') where User='root';
刷新执行: MysqL> flush privileges;

1. 使用具有所有权限的用户登录 2. 创建用户MysqL> insert into MysqL.user(Host,User,Password) values("localhost","demo",password("demo")); flush privileges; 3. 退出,用demo用户登录MysqL 4. 成功登录退出 5. 为用户授权:grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码"; (grant all privileges on *.* to demo@localhost identified by 'demo'; ) 6. 刷新系统权限表:MysqL>flush privileges;

猜你在找的CentOS相关文章