`

mysql 修改root密码,分配权限

 
阅读更多

1.如我的Mysql 安装在E:\xampp\mysql目录下

win7下使用CMD,命令行使用无密码的root用户登录mysql数据库,红色字体为命令

1).更新root用户密码为root

2.)刷新权限

3).分配root用户在任何主机上都可以访问mysql数据库

4).刷新权限

 

E:\xampp\mysql\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.5.25a MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> update mysql.user set password=PASSWORD('root') where user='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant
 option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

 

2.使用修改过得root用户密码root登录Mysql

 

E:\xampp\mysql\bin>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.25a MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| mysql              |
| oms                |
| performance_schema |
| phpmyadmin         |
| test               |
| webauth            |
+--------------------+
8 rows in set (0.00 sec)

mysql>

 

 

 

  • 大小: 107.9 KB
分享到:
评论

相关推荐

    Mysql用户密码

    Mysql用户密码设置修改和权限分配.

    mysql-8.0.20-macos10.15-x86_64.tar.gz

    修改root密码,并为 PASSWORD EXPIRE NEVER 永不过期 mysql> alter user 'root'@'localhost' identified by '12345678' PASSWORD EXPIRE NEVER; mysql> flush privileges; mysql> quit; 设置远程访问 允许root...

    mysql基础只是总结

    4、输入mysql -u root -p 回车 无需密码 5、通过上述密码修改方法3修改密码 6、flush privileges 7、exit 8、资源管理器kill进程mysqld 或者 mysql-nt 不要把mysql.exe 9、net start mysql 【简单的用户权限...

    SpringMyBatisShiro:SpringBoot + MyBatis + Shiro + Redis + MySQL

    用admin/123456,拥有index权限reports未任何权限, lance/123456尚未分配任何权限. 参考 shiro Cache交于Redis进行管理 SpringBoot整合A.CTable 本项目配合Angular 2+ ,实现SPA(single page applications)的CROS...

    mysql用户管理操作实例分析

    服务端可以对用户的权限来进行更改,所以每个用户对数据库或对数据表的权限都是不一样的。 一般来说不应该使用root用户登录,因为root用户拥有最高的权限,可以进行删除数据库等“危险”操作。为了安全,应该使用...

    Mysql账户管理原理与实现方法详解

    如果某用户如root,拥有服务实例级分配的权限,那么该账号就可以删除所有的数据库、连同这些库中的表 数据库级别账号:对特定数据库执行增删改查的所有操作 数据表级别账号:对特定表执行增删改查等所有操作 字段级别...

    《数据库系统原理》实验10:数据库的安全性设计

    在这里,我们可以发现root是MySQL最高级别权限的用户,它拥有查看、修改和删除MySQL软件中所有数据库的权限。当需要有多个数据库,并且分配给不同的用户使用,多个用户之间只有查看自己对应数据库的权限,不相互干扰...

    安卓大作业基于Android的宿舍管理系统源码

    系统主要功能包括角色权限管理宿舍分配、宿舍自选、学生信息管理、公寓信息管理、学生入住管理、学生退宿管理、宿舍调整管理、批量退宿、批量入住临客管理功能、学生违纪登记、物品维修登记、访客信息登记、物品借用...

    交友相亲社交网站模板支持手机wap版

    可以用phpmyadmin去新建一个mysql数据库,比如数据库名为wrzcnet_phpjiaoyou,数据库用户名可用原来默认的root,或者再建一个数据用户和密码,比如root和root ●打开数据库文件下的data.txt,复制里面的内容,打开...

    oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 连接字符串

    说明:修改用户密码一般有两种方式,一种是通过命令password修改,另一种是通过语句alter user实现,如果要修改他人的密码,必须要具有相关的权限才可以 用法: 方式一 password [用户名] 方式二 alert user 用户名...

    易孚网站系统(EIFR) 2012.1

    针对上述操作系统做了大量的测试和实地检验,保证 EIFR 可以在上述系统中安全稳定的运行,但您仍然需要做好服务器操作系统 级的安全防备措施,例如 Windows 用户需更改 MySQL for Windows 的初始 root 密码,避免跨...

    入门学习Linux常用必会60个命令实例详解doc/txt

    chsh命令的作用是更改使用者shell设定,它的使用权限是所有使用者。 2.格式 chsh [ -s ] [ -list] [ --help ] [ -v ] [ username ] 3.主要参数 -l:显示系统所有Shell类型。 -v:显示Shell版本号。 4....

Global site tag (gtag.js) - Google Analytics