操作系统:linux
Mysql版本:mysql-5.6.24
mysql-5.6.24.tar.gz
mkdir /usr/setup
上传mysql-5.6.24.tar.gz到/usr/setup
yum -y install make cmake gcc-c++ bison-devel ncurses-devel openssl-devel.x86_64
查找系统里是否已经安装了mysql数据库的相关组件,使用命令:
rpm -qa | grep mysql
进行查找,如果查找到,可以使用下面命令进行强制卸载:
rpm -e --nodeps 包名。
cd /usr/setup/ tar -zxvf mysql-5.6.24.tar.gz cd mysql-5.6.24 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_SSL=yes
make make install
groupadd mysql useradd -g mysql mysql chown mysql.mysql /usr/local/mysql�CR
/usr/local/mysql/scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
cp /usr/setup/mysql-5.6.24/support-files/my-default.cnf/etc/my.cnf cp/usr/setup/mysql-5.6.24/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld vi /etc/my.cnf [mysqld] ##添加下面的内容 datadir =/usr/local/mysql/data socket =/var/lib/mysql/mysql.sock basedir =/usr/local/mysql/ port = 3306 server_id = 1 report-port =3306
/etc/init.d/mysqld start
/usr/local/mysql/bin/mysql -uroot-p 默认没有密码。
/usr/local/mysql/bin/mysqladmin -uroot password 'mysql' 登录测试 /usr/local/mysql/bin/mysql �Curoot -p
设置开机自启动 chkconfig mysqld on chkconfig --list|grep mysql 添加mysql的环境变量 vi /etc/profile PATH=/usr/local/mysql/bin:$PATH export PATH source /etc/profile 删除空用户 mysql -uroot -p use mysql; selectdistinct(user) from user; delete from userwhere user=''; flushprivileges; selectdistinct(user) from user;
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_INCLUDE_DIR
used as include directory in directory /opt/mysql-5.6.24/CMakeFiles/CMakeTmp
-- Performing Test HAVE_PEERCRED - Success
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Download failed, error: 28;"a timeout was reached"
-- To enable google test, please download http://googlemock.googlecode.com/files/gmock-1.6.0.zip to the directory /opt/mysql-5.6.24/source_downloads
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring incomplete, errors occurred!
See also "/opt/mysql-5.6.24/CMakeFiles/CMakeOutput.log".
See also "/opt/mysql-5.6.24/CMakeFiles/CMakeError.log".
出错原因:没有安装openssl
解决方法如下:
yum install -y openssl-devel.x86_64
http://jingyan.baidu.com/article/67508eb43f68869cca1ce4e5.html?qq-pf-to=pcqq.c2c