Mysql(5.6.35)在Linux(Centos 6.8)上安装

1 下载

下载地址:https://dev.mysql.com/downloads/mysql/5.6.html#downloads

这里我选择5.6.41 Linux-Generic,如下图:
2efdc09b05b972b34f8e7408b3f79712521.jpg
再选择Linux - Generic (glibc 2.5) (x86, 64-bit), Compressed TAR Archive包,根据系统选择32或64位,如下图:
e15258106b741809aa6b44cd50e1e14686c.jpge09f48290f0da86ee0f1180ad53310deeb6.jpg
点击下载

2 解压

root用户登录,上传安装包到服务器
cd /opt
rz
解压
tar -xvf mysql-5.6.41-linux-glibc2.12-x86_64.tar
复制解压后的mysql目录
cd mysql-5.6.41-linux-glibc2.12-x86_64

mkdir /usr/loacl/mysql

cp -r ./* /usr/local/mysql

3 添加用户组和用户

添加用户组
groupadd mysql
添加用户mysql到用户组
useradd -g mysql mysql

4 安装

cd /usr/local/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp support-files/mysql.server /etc/init.d/mysql
cp support-files/my-default.cnf /etc/my.cnf    

vi /etc/my.cnf

修改:

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
server_id=1
socket=/tmp/mysql.sock

添加:

character_set_server=utf8

加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了

export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile

启动mysql
service mysql start

修改root密码

mysqladmin -u root password '123456'

测试连接
mysql -u root -p
关闭mysql
service mysql stop
查看运行状态
service mysql status

开机自启动配置
chkconfig --add mysql
chkconfig --list
chkconfig --level 345 mysql on

允许所有外部链接访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;

5 注意事项

安装时的一些错误
   -bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: 没有那个文件或目录
   解决: yum -y install perl perl-devel
  Installing MySQL system tables…./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
   解决:yum -y install libaio-devel

   Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

     解决:yum -y install numactl

 

启动时一些错误

    Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

        解决:关闭selinux 在/etc/selinux/config下永久关闭,临时关闭使用setenforce 0命令。

    

转载于:https://my.oschina.net/jzgycq/blog/868636

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值