时间:2021-07-01 10:21:17 帮助过:29人阅读
linux enterprise 5下安装mysql 5.6
mysql从5.5之后安装开始用cmake安装,cmake是安装mysql5.5之后版本必不可少的工具。
安装cmake如下,从cmake官网下载源码安装包
[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
[root@localhost ~]# tar zxvf cmake-2.8.10.2.tar.gz
[root@localhost ~]# cd cmake-2.8.10.2
[root@localhost ~]# ./configure
[root@localhost ~]# make && make install
cmake 安装成功,接下来安装mysql5.6.11
参考http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
解压mysql安装包
[root@localhost ~]# tar zxvf mysql-5.6.11.tar.gz
进入mysql解压后的目录 cd mysql-5.6.11,指定mysql放那个目录,--CMAKE_INSTALL_PREFIX=/usr/local/mysql5.6,指定mysql数据目录,--datadir=/usr/local/share/xxxxx
--
创建安装目录 mkdir /usr/local/mysql
创建数据存放目录 mkdir /usr/local/mysql/data
[root@localhost ~]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
修改 目录权限
cd /usr/local/mysql
chown -R root:mysql .
chown -R mysql:mysql data
创建系统数据库的表
cd /usr/local/mysql/scripts
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
执行要加上 --basedir --datadir 参数 ,否则报如下错误
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
cp support-files/my-default.cnf /etc/my.cnf
加环境变量
这样一个mysql 5.6 就安装完了
bitsCN.com