170425、centos安装mysql5.6数据库

# rpm -qa | grep mysql ## 查看该操作系统上是否已经安装了 mysql 数据库,
有的话,可以通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉
# yum install mysql-server mysql mysql-devel
# service mysqld start
# chkconfig --list | grep mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
用上面的命令查看到 MySQL 并没有设置开机启动,所以需要设置开机启动
# chkconfig mysqld on
为了方便远程管理,防火墙中打开 3306 端口
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
重启防火墙,使端口配置生效
# service iptables restart
设置 MySQL 数据库 root 用户的密码:
# mysqladmin -u root password 'root'
登录数据库:
# mysql -u root -p
MySQL 授权远程访问(先用 root 登录 mysql)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH
GRANT OPTION;
mysql> FLUSH PRIVILEGES;

 

# rpm -qa | grep mysql ## 查看该操作系统上是否已经安装了 mysql 数据库,有的话,可以通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉# yum install mysql-server mysql mysql-devel# service mysqld start# chkconfig --list | grep mysqldmysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off用上面的命令查看到 MySQL 并没有设置开机启动,所以需要设置开机启动# chkconfig mysqld on为了方便远程管理,防火墙中打开 3306 端口# vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT重启防火墙,使端口配置生效# service iptables restart设置 MySQL 数据库 root 用户的密码:# mysqladmin -u root password 'wusc.123'登录数据库:# mysql -u root -pMySQL 授权远程访问(先用 root 登录 mysql)mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'wusc.321' WITHGRANT OPTION;mysql> FLUSH PRIVILEGES;

posted @ 2017-06-16 20:30  目标奔雷手  阅读(198)  评论(0编辑  收藏  举报