wangbin
  • wangbin
  • 2016-01-03
  • IT

centos6.7安装mysql

一. 简介

最近买了个vps玩玩,用的是centos6.7系统,先后在上面装了tomcat、mysql、svn、nginx、php以及gitblog。纪录下,这篇是centos6.7安装mysql的过程。

二. 安装

jsp项目需要mysql来存储数据,执行下面指令安装mysql

install_mysql.sh

centos6

cd ~
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-release-el6-5.noarch.rpm
yum install -y mysql-server mysql mysql-deve

centos7

cd ~
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-server
chkconfig mysqld on
service mysqld start

mysqladmin -u root password 'yourpassword'

rm -f ~/mysql-community-release-el7-5.noarch.rpm 

执行rpm -qi mysql-server可以显示mysql版本信息,安装成功。

开启mysql服务

service mysqld start

设置root密码

 mysqladmin -u root password '123456'

增加开机启动mysql

chkconfig --list | grep -i mysql
chkconfig mysqld on

终端执行mysql -u root -p后输入密码123456,显示mysql>,说明登陆成功,安装mysql完成。

参考:

  1. http://www.cnblogs.com/shenliang123/p/3203546.html