基于centos7搭建mysql

[root@localhost ~]# cd /etc/yum.repos.d

[root@localhost yum.repos.d]# mkdir l

[root@localhost yum.repos.d]# ls

CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo

CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  l

[root@localhost yum.repos.d]# mv C* l

[root@localhost yum.repos.d]# ls

l

[root@localhost yum.repos.d]# vim l.repo

[root@localhost yum.repos.d]# mount /dev/sr0 /media

mount: /dev/sr0 写保护,将以只读方式挂载

[root@localhost ~]# ls

anaconda-ks.cfg     initial-setup-ks.cfg  公共  视频  文档  音乐

cmake-2.8.6.tar.gz  mysql-5.5.22.tar.gz   模板  图片  下载  桌面

[root@localhost ~]# yum -y install ncurses-devel

 

[root@localhost ~]# tar zxf cmake-2.8.6.tar.gz -C /usr/src/

[root@localhost ~]# tar zxf mysql-5.5.22.tar.gz -C /usr/src/

[root@localhost ~]# cd /usr/src

[root@localhost src]# ls

cmake-2.8.6  debug  kernels  mysql-5.5.22

[root@localhost cmake-2.8.6]# ./configure

[root@localhost cmake-2.8.6]# gmake && gmake install

[root@localhost cmake-2.8.6]# cd -

/usr/src

[root@localhost src]# ls

cmake-2.8.6  debug  kernels  mysql-5.5.22

[root@localhost mysql-5.5.22]#  cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all

[root@localhost mysql-5.5.22]# make && make install

[root@localhost mysql-5.5.22]# useradd -M -s /sbin/nologin mysql

[root@localhost mysql-5.5.22]# chown -R mysql.mysql /usr/local/mysql/

[root@localhost mysql-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf

cp:是否覆盖"/etc/my.cnf"? y

[root@localhost mysql-5.5.22]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data

Installing MySQL system tables...

OK

Filling help tables...

OK

 

[root@localhost mysql-5.5.22]# echo "PATH=$PATH:/usr/local/mysql/bin/"  >> /etc/profile

[root@localhost mysql-5.5.22]# . /etc/profile

[root@localhost mysql-5.5.22]# cp support-files/mysql.server /etc/init.d/mysqld

[root@localhost mysql-5.5.22]# chmod +x /etc/init.d/mysqld

[root@localhost mysql-5.5.22]# chkconfig --add mysqld

[root@localhost mysql-5.5.22]# systemctl restart mysqld

[root@localhost mysql-5.5.22]# mysql -u root

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

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

MySQL [(none)]>

 

成功

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值