mysql 版本 5.6.33
按照按照步骤走应该是没问题,我自己按照了2遍,之间可能有其他问题,
教程第6步总结了我自己出现的问题,如果出现其他问题需要协助也可加我QQ进行沟通交流,谢谢!
1.下载 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
2.解压
tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
复制解压后的mysql目录
cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql
3.添加用户组
groupadd mysql
useradd -g mysql mysql
4.安装
cd /usr/local/mysql/
mkdir ./data/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
5.修改脚本
vi /etc/init.d/mysqld
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/mysql
加入环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/mysql//bin
生效命令:source /etc/profile
启动停止状态
service mysqld start
service mysqld stop
service mysqld status
6.可能出现的问题脚本解决[我遇到的,可能每个人遇到的问题不一样,具体问题具体解决]
问题 centos -bash: vim: command not found
解决:yum -y install vim-enhanced
问题 please install the following Perl modules before executing ./scripts/mysql_install_db:
解决:yum install autoconf
问题 本地远程连接还是连接不上
解决:防火墙端口问题:可以开放mysql 3306端口 也可以直接关闭防火墙: service firewalld stop
7.初始化mysql密码
linux执行 mysql -u root mysql
use mysql;
update user set password=password("123456") where user="root";
flush privileges;
允许mysql远程连接:
select user,host from user;
如果没有"%"这个host值,就执行下面这两句
update user set host='%' where user='root';
flush privileges;