一、查看mysql版本
yum list | grep mysql
二、安装mysql
yum install -y mysql-server mysql mysql-deve
Installed:
mysql.x86_64 0:5.1.73-8.el6_8 mysql-server.x86_64 0:5.1.73-8.el6_8
Dependency Installed:
perl.x86_64 4:5.10.1-144.el6 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6 perl-Module-Pluggable.x86_64 1:3.90-144.el6
perl-Pod-Escapes.x86_64 1:1.04-144.el6 perl-Pod-Simple.x86_64 1:3.13-144.el6 perl-libs.x86_64 4:5.10.1-144.el6 perl-version.x86_64 3:0.77-144.el6
Dependency Updated:
mysql-libs.x86_64 0:5.1.73-8.el6_8
Complete!
三、启动mysql服务
service mysqld start
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
四、设置开机启动
chkconfig mysqld on
五、查看是否开机启动
chkconfig –list | grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
六、设计root密码
/usr/bin/mysqladmin -u root password ‘qwerzxcv’
七、登录数据库
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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>
八、centos7安装mysql
- 在安装前执行命令:
sudo rpm -Uvh
http://dev.mysql.com/get/mysq…
- 然后正常安装mysql