【腾讯云】云产品限时秒杀,爆款1核2G云服务器,首年99元

centos 安装mysql

1.安装mysql,执行如下命令

yum install mysql mysql-server -y

2.启动mysql服务,执行如下命令

/etc/init.d/mysqld start

3.设置mysql为开机启动执行如下命令

chkconfig mysqld on

4.拷贝配置,执行如下命令

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

5.给root账户上设置密码,执行如下命令

mysql_secure_installation

按照提示设置密码,其他可以都按y执行

6.登录mysql,执行如下命令

mysql -u root -p

7.mysql数据库文件位置,执行如下命令

show variables like 'datadir%'

默认位置在 /var/lib/mysql

 

posted @ 2017-11-20 14:49  happenzh  阅读(105)  评论(0编辑  收藏  举报