时间:2021-07-01 10:21:17 帮助过:25人阅读
yum -y install ntp cmake make openssl openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ flex bison bzip2 bzip2-devel libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel
1、创建mysql用户及用户组
useradd -M -s /sbin/nologin mysql
2、创建mysql数据库存放目录
mkdir -p /data/mysql #存放数据库
3、解压安装mysql
tar -zxvf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.31-linux-glibc2.5-x86_64 /usr/local/mysql cd /usr/local/mysql make && make install
//使用cmake则需要使用CMAKE参数,以下说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //默认安装目录
-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
//CMAKE详细介绍参见
注意事项:
如安装失败重新编译时,需要清除旧的对象文件和缓存信息。
make clean
rm -f CMakeCache.txt
rm -rf /etc/my.cnf
4、设置目录权限并创建系统数据库的表
chown -R mysql.mysql /usr/local/mysql chown -R mysql.mysql /data/mysql cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //将mysql的启动服务添加到系统服务中 /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql
5、设置环境变量
vi /etc/profile export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib source /etc/profile
7、开启mysql服务
shell> service mysql start Starting MySQL....... [确定] shell> chkconfig --add mysql //加入开机启动服务
8、修改MySQL的root用户的密码以及打开远程连接
shell> mysql -u root mysql mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "passwd"; Query OK, 0 rows affected (0.09 sec) mysql> update user set password=password(‘passwd‘) where user=‘root‘; mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit shell>mysql -u root -p Enter password:
本文出自 “学习Linux” 博客,请务必保留此出处http://linuxlearn.blog.51cto.com/1437234/1789020
centos6.5 mysql5.6 不编译安装
标签:mysql5.6 不编译安装