首页 > 数据库技术 > 详细

极简创建mysql数据库

时间:2015-12-15 12:02:41      阅读:209      评论:0      收藏:0      [点我收藏+]

#以下这条命令是解决云模板中的MariaDB与MySQL相关软件包冲突问题

yum remove MariaDB* -y

#安装启动MySQL数据库服务器

yum install mysql-server -y

#如果使用的是MariaDB,以下命令改为service mysql start

service mysqld start

#设置数据库管理员初始密码为password

mysqladmin -u root password ‘password‘

#开启防火墙数据库相关端口

iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

service iptables save

#如果使用的是MariaDB,以下命令改为chkconfig mysql on

chkconfig mysqld on

 

使用mysql工具连接失败:

 

1130 - host is not allowed to connect to this mysql server

 

   未开启远程连接  

解决方案:

#使用root登录mysql
mysql -uroot -ppassword
>use mysql;
#更改user表
>update user set host = ‘%‘ where user = ‘root‘;
#验证结果
>select host, user from user;
+-----------+------+
| host      | user |
+-----------+------+
| %         | root |
| 127.0.0.1 | root |
| centos |      |
| centos | root |
| localhost |      |
+-----------+------+
5 rows in set (0.00 sec)

  

技术分享

 

极简创建mysql数据库

原文:http://www.cnblogs.com/amusic/p/5047598.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!