Mysql5.6源码安装

安装系统:CentOS7.7_x64
Mysql版本:mysql-5.6.38.tar.gz
Cmake版本:cmake-2.8.4.tar.gz

[root@c7-45 ~]#  yum -y install gcc gcc-c++ bison ncurses  ncurses-devel boost

1.安装依赖包

[root@c7-45 ~]# ls
anaconda-ks.cfg  cmake-2.8.4.tar.gz  mysql-5.6.38.tar.gz

2.上传安装包

[root@c7-45 ~]# ls
cmake-2.8.4.tar.gz  mysql-5.6.38.tar.gz

3.安装cmake

[root@c7-45 ~]# tar zxf cmake-2.8.4.tar.gz
[root@c7-45 ~]# cd cmake-2.8.4/
[root@c7-45 cmake-2.8.4]# ./configure
[root@c7-45 cmake-2.8.4]# make && make install
[root@c7-45 cmake-2.8.4]# cmake -version
cmake version 2.8.4

4.安装mysql

[root@c7-45 ~]# useradd mysql
[root@c7-45 cmake-2.8.4]# cd
[root@c7-45 ~]# tar zxf mysql-5.6.38.tar.gz
[root@c7-45 ~]# cd mysql-5.6.38/
[root@c7-45 mysql-5.6.38]# cmake .
[root@c7-45 mysql-5.6.38]# make && make install

5.Mysql初始化


[root@c7-45 mysql-5.6.38]# chown -R mysql.mysql /usr/local/mysql/
[root@c7-45 mysql-5.6.38]# cd /usr/local/mysql/scripts/
[root@c7-45 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/

6.给mysql提供配置文件:


[root@c7-45 scripts]# cd /usr/local/mysql/data/
[root@c7-45 data]# cd /usr/local/mysql/
[root@c7-45 mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? yes
[root@c7-45 mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@c7-45 mysql]# service mysqld start
Starting MySQL.Logging to '/usr/local/mysql/data/c7-45.err'.
 SUCCESS!
[root@c7-45 mysql]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@c7-45 mysql]# ps -ef | grep mysqld
[root@c7-45 mysql]# ss -ntlp  |grep 3306

[root@c7-45 mysql]# chkconfig --add mysqld
[root@c7-45 mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.38 Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
#5.7以下版本默认情况下root用户没有密码,可以直接登录

7.给root设置密码

6
Warning: Using a password on the command line interface can be insecure.
[root@c7-45 mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@c7-45 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.38 Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云原生解决方案

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值