Centos 7 mysql安装
安装wget
yum -y install wget
下载mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
解压mysql
rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装mysql
yum install mysql-server
yum install mysql-devel
在mysql配置文件/etc/my.cnf的[mysqld]中加入character-set-server=utf8
启动mysql服务
service mysqld start
停止mysql服务
service mysqld stop
登录mysql(刚安装密码为空,直接按回车)
mysql -u root -p
切换到mysql数据库
use mysql;
修改root密码
UPDATE user SET password=password("你的密码") WHERE user='root';
刷新权限
FLUSH PRIVILEGES;
创建用户
create user 'test'@'%' identified by '123456';
创建远程连接用户
grant all on *.* to 用户名@'%' identified by '密码';
创建本地用户
grant all on *.* to 用户名@'localhost' identified by '密码';
创建用户时的权限
grant select,insert,update,delete on *.* to 用户名@‘localhost’ identified by '密码';
删除用户
Delete FROM user Where User='test' and Host='localhost';
本文介绍了在Centos 7系统上安装MySQL的详细步骤,包括安装wget、下载和解压MySQL、安装MySQL服务及开发包等。还说明了MySQL的启动与停止方法,以及登录、修改密码等操作。此外,讲解了创建不同类型用户、设置权限和删除用户的操作。
2160

被折叠的 条评论
为什么被折叠?



