MyMql 下载以及配置
MYSQL 下载地址 https://www.mysql.com/
1.下载安装ZIP 压缩包 解压到安装目录
2.选择path添加:mysql安装目录下的bin文件夹地址
3.在你的mysql安装目录下,新建my.ini文件,编辑 my.ini文件,注意替换路径位置
4.启动管理员模式下的cmd,并将路径切换至mysql安装目录下的bin目录,输入以下命令
d:
cd D:\Program Files\mysql-8.0.21-winx64\bin
mysqld -install
mysqld --initialize-insecure --user=mysql (初始化数据库)
net start mysql (启动mysql)
进入mysql管理界面修改密码(第一次输入密码回车即可)
1>输入以下第一条命令进入管理界面(p后面没有空格!!)
2>在输入第二条命令修改密码(最后一定要有分号)
mysql -u root -p #让你输入密码时直接回车即可
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
4.登录数据库
mysql -u root -p
输入密码
5.查询数据库
use mysql;
6.查询host
select user,host from user;
7.创建新用户
create user 'username'@'host' identified by '123123';
8.授权
update user set host='%' where user='usemame';
9.修改密码
alter user 'username'@'%' identified by '123123';
10.建库 建用户
CREATE DATABASE stowage;
CREATE USER 'stowage'@'%' IDENTIFIED BY 'admin123';
GRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE, ALTER ROUTINE, CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, EVENT ON `stowage`.* TO 'stowage'@'%';
GRANT GRANT OPTION ON `stowage`.* TO 'stowage'@'%';
11.修改账户密码加密规则并更新用户密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限