下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
1、centeros安装mysql
参考地址:http://www.linuxidc.com/Linux/2016-09/134940.htm
yum install mysql-server
若提示没有可用软件包,则需进行下列操作:
//下载mysql的repo源
[rooot@localhost ~ ] wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
//安装,将获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-#community.repo,/etc/yum.repos.d/mysql-community-source.repo [rooot@localhost ~ ] rpm -ivh mysql-community-release-el7-5.noarch.rpm
然后:
yum install mysql mysql-server mysql-libs mysql-server;
参考自:https://www.cnblogs.com/snake-hand/p/3157247.html
//检查是否安装
rpm -qa|grep -i mysql
//启动mysql服务
service mysql start
//以root身份打开数据库
mysql -u root
2、ubuntu安装mysql
sudo apt-get install mysql-server
安装mysql之后,创建用户:
[rooot@localhost ~ ] mysql -u root -p
// 输入密码后,1、创建用户
MySQL [(none)]> CREATE USER 'hive'@'%' IDENTIFIED BY 'hive'; // 2、赋予权限 MySQL [(none)]> GRANT ALL PRIVILEGES OON *.* TO 'hive'@'%' WITH GRANT OPTION; // 3、强制写出 MySQL [(none)]> flush privileges; // 为了让远程用户可以访问mysql,修改/etc/mysql/my.cnf文件,注释bind-address一行,如下 #bind-address
//重启mysql
sudo /etc/ini.d/mysql restart