windows 下mysql安装

  1. 安装目录下编写my.ini文件
  [client]
port=3306
[mysqld]
character-set-server=utf8
#shared-memory
#skip-grant-tables
[mysql]
default-character-set=utf8
  1. 在bin目录打开cmd
1.输入 mysqld --initialize --console【可以看到随机生成的密码】  (直接使用  mysqld --initialize-insecure 这样可以初始化root用户密码为空,不需要加 shared-memory skip-grant-tables )
(如果输入 mysqld --initialize  看不到随机密码 就需要开放 shared-memory skip-grant-tables)
 2.输入mysqld --console
 3.打卡另一个窗口输入   mysql -uroot  
 4. 输入  flush privileges;(需要先刷新权限,不然报错The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement)
 5. 设置密码  alter user'root'@'localhost' IDENTIFIED BY 'zlc@123';
 6. 操作完成删除my.ini文件中的shared-memory,skip-grant-tables 重启服务
  1. 解释
skip-grant-tables
上面表示第一次登陆root没有密码 需要安全模式
shared-memory
上面 加上这个 mysqld --console 才能启动 不然报错(TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS)

本文没有注册服务通过  mysqld --console 打开服务
  1. 常用命令
1.添加用户  
create user 'zlc'@'localhost' identified by 'zlc@123';
2.用户授权
grant select, insert on database.* to  'zlc'@'localhost';
3.创建用户同时授权
grant all privileges on database.* to  'zlc'@'localhost' identified by 'zlc@123';  flush privileges;//刷新权限
4.删除用户
drop user 'zlc'@'localhost';
5.查看存储过程
select * from mysql.proc where db = 'zlc' and `type` = 'PROCEDURE'\G
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值