在mysql建立数据库服务器_创建mysql数据库

centos7参考:http://www.cnblogs.com/starof/p/4680083.html

mysql-community-release包下载连接:http://files.cnblogs.com/files/amusic/mysql-community-release-el7-5.noarch.zip

以下为centos6环境,

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

yum remove MariaDB* -y

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

yum install mysql-server -y

#

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工具连接失败:

一:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor

更新权限

#登录mysql

mysql -uroot -ppassword

#切换数据库

>use mysql;

>update user set password=password('newpassword') where user='root';

#更新权限

>flush privileges;

>quit

二:

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)

65a561beb362e56b7abb2bb886eef47b.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值