centos7安装mysql--亲测有效

1、先检查系统是否装有mysql

rpm -qa | grep mysql

删除可用yum -y remove

2.下载mysql的repo源

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

安装mysql-community-release-el7-5.noarch.rpm包

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

安装这个包后,会获得两个mysql的yum repo源(在cd /etc/yum.repos.d/查看):

/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。

3,。安装mysql

sudo yum install mysql-server

安装后再次查看mysq

rmp -qa | grep mysql

扫描二维码关注公众号,回复: 10063188 查看本文章

如果报错,内容含有

Error: Package: mysql-community-libs-5.6.35-2.el7.x86_64 (mysql56-community) Requires: libc.so.6(GLIBC_2.17)(64bit) Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community) Requires: libc.so.6(GLIBC_2.17)(64bit) Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community) Requires: systemd Error: Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community) Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) Error: Package: mysql-community-client-5.6.35-2.el7.x86_64 (mysql56-community) Requires: libc.so.6(GLIBC_2.17)(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

解决:

#yum install glibc.i686 

# yum list libstdc++*

 

启动MySQL:service mysqld start

 

4、重置密码

重置密码前,首先要登录

mysql -u root

mysql > use mysql;

mysql > update user set password=password('123456') where user='root'; mysql > exit;

重启mysql服务后才生效 # service mysqld restart

必要时加入以下命令行,为root添加远程连接的能力。链接密码为 “root”(不包括双引号)

mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";  

到此,安装完毕

5.创建hive用户

创建一个新的数据库:create database hive;

创建一个新的用户:

 create user 'hiveowner'@'%' identified by 'Welcome_1';

  

给该用户授权

grant all on hive.* TO 'hiveowner'@'%';

grant all on hive.* TO 'hiveowner'@'localhost' identified by 'Welcome_1';

发布了22 篇原创文章 · 获赞 0 · 访问量 6757

猜你喜欢

转载自blog.csdn.net/djw745917/article/details/88412625
今日推荐