第一步进入服务器下载mysql安装包:
root@localhost ~]# rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 或者 rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
然后安装mysql:
yum install -y mysql-server 或者 yum install mysql-community-server 显示 Complete! 说明安装成功
启动mysql:
sudo service mysql start
查看mysql进程:
ps -ef | grep mysql
连接mysql:
mysql -u root -p 密码直接回车
建立数据库、新建用户、给予权限:
create database mytest;
create user 'test'@'%' identified by '123456';
grant all on *.* to 'test'@'%' with grant option;
进入数据库:
use mytest