标签:auto my.cnf pcr 成功 roo 服务 匿名 dev 运行
先执行命令yum install cmake
mysql5.7采用的是cmake安装(更先进的configure)
wget下载目录(到清华大学的镜像站下载)
[root@localhost local]# cd /usr/local/src
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7/mysql-5.7.17.tar.gz
解压 [root@localhost src]# tar vfxz mysql-5.5.17.tar.gz
[root@localhost src]# cd /usr/local/src/mysql-5.5.17
为了防止因为缺少什么而出现错误,现在集成安装一下
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel
freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-
devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-
devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl
openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-
servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel
然后执行如下命令:
[root@localhost mysql-5.5.17]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
ok,cmake编译成功
再执行make && make install
时间稍长(15分钟),耐心等待中...
配置mysql文件
先查看一下:
[root@localhost mysql-5.5.17]# cp support-files/my-medium.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
[root@localhost mysql-5.5.17]# useradd mysql
[root@localhost mysql-5.5.17]# chmod +x /usr/local/mysql
[root@localhost mysql-5.5.17]# chown -R mysql.mysql /usr/local/mysql
初始化mysql数据库
[root@localhost mysql-5.5.17]# /usr/local/mysql/scripts/mysql_install_db \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data &
把mysql目录的主人由mysql改为root
[root@localhost local]# chown -R root /usr/local/mysql
把mysql目录的主人由root改为mysql
[root@localhost local]# chown -R mysql /usr/local/mysql/data
运行mysql服务
[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
crtl+c退出
查看是否启动成功
启动成功啦,嘿嘿
测试一把mysql
[root@localhost bin]# /usr/local/mysql/bin/mysql
设置mysql登录用户名和密码
首先,删除匿名用户:
好了,留下了 一个root的用户,就ok了
然后更改root账户的密码
还有最后一步,刷新权限,以便于立马生效
来,测试一把是否生效
ok,成功了!
标签:auto my.cnf pcr 成功 roo 服务 匿名 dev 运行
原文地址:http://www.cnblogs.com/xiong63/p/6270318.html