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 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):
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启动)

首次登录,修改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下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native