登录mysql默认没有指定账号

查看默认账号是谁

select user();

mysql> select user();
+----------------+
| user() |
+----------------+
| ODBC@localhost |
+----------------+
1 row in set (0.03 sec)

默认账号是 ODBC

切换mysql账号

-u 指定mysql账号

-p 指定mysql密码

mysql -uroot -p

mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.06 sec)

登录设置密码

初始状态下,管理员root,密码为空,默认只允许从本机登录localhost

设置初始密码
mysqladmin -uroot password "123"        设置初始密码 由于原密码为空,因此-p可以不用

也可以设置-p

mysqladmin -uroot -p password "123"
C:\Users\Administrator.QH-20170325TNQR>mysqladmin -uroot -p password "123"
Enter password:
Warning: Using a password on the command line interface can be insecure. C:\Users\Administrator.QH-20170325TNQR>
C:\Users\Administrator.QH-20170325TNQR>
C:\Users\Administrator.QH-20170325TNQR>mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
O)
C:\Users\Administrator.QH-20170325TNQR>mysql -uroot -p123
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.41 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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>
修改mysql密码
mysqladmin -uroot -p"123" password "456"        修改mysql密码,因为已经有密码了,所以必须输入原密码才能设置新密码
 

windows平台mysql密码设置的更多相关文章

  1. windows平台MySQL密码设置与破解

    一:制作系统服务: 1.在cmd下输入 mysql 这个相当于启动服务端了,然后该启动客户端了 .就表示安装成功. 2.再重新开启一个 cmd 窗口.kill 进程. 输入 mysql 即可进入 my ...

  2. windows平台mysql密码破解设置

    windows平台下,5.7版本mysql,破解密码的两种方式: #1 关闭mysql服务net stop mysql 启动mysql服务 跳过权限 #2 在cmd中执行:mysqld --skip- ...

  3. linux平台mysql密码设置

    登录mysql默认没有指定账号 查看默认账号是谁 select user(); mysql> select user();+----------------+| user() |+------- ...

  4. xampp默认mysql密码设置,修改mysql的默认空密码

    xampp默认mysql密码设置,修改mysql的默认空密码 分类: xampp2012-09-12 11:24 30264人阅读 评论(5) 收藏 举报 mysqlphpmyadminauthent ...

  5. linux平台及windows平台mysql重启方法

    各个平台mysql 重启: inux平台及windows平台mysql重启方法 Linux下重启MySQL的正确方法: 1.通过rpm包安装的MySQL service mysqld restart ...

  6. 【mysql】mysql密码设置和更改

    密码设置: 当用户没有设置密码时: 添加密码: mysqladmin -uroot -password ab12 注:因为开始时root没有密码,所以-p旧密码一项就可以省略了. 当用户存在密码时: ...

  7. MySQL 密码设置

    如何修改 MySQL 密码: [root@localhost ~]$ mysqladmin -uroot password 'newPass' # 在无密码的情况下设置密码 [root@localho ...

  8. windows mysql密码设置与破解

    1.设置密码 mysqladmin -uroot -p password "1234" 查看当前用户: 2.破解密码 关闭 MySQL 服务 执行 mysqld --skip-gr ...

  9. MYSQL密码设置

    当MYSQL安装成功后,root用户的密码默认是空的,有三种方式可以重新设置root账号的密码 1.用root 进入mysql后 mysql>set password =password('你的 ...

随机推荐

  1. PHP一致性哈希实现。。

    <?php /** *@author:xiaojiang 20140222 * 一致性哈希php 实现 */ class MyHash{ //虚拟节点数 private $_virtualCou ...

  2. php_admin_value open_basedir 引起的上传文件失败解决方法

    为了安全,我们通常会在虚拟主机设置中,加入这一行php_admin_value open_basedir "/usr/local/apache/htdocs/www"但这会导致mo ...

  3. drizzleDumper的原理分析和使用说明

    https://blog.csdn.net/qq1084283172/article/details/53561622 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog. ...

  4. 【贪心】PAT 1033. To Fill or Not to Fill (25)

    1033. To Fill or Not to Fill (25) 时间限制 10 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 ZHANG, Gu ...

  5. [OpenGL]用OpenGL制作动画

    //在窗口内绘制一个移动的矩形 /*我们通常还可以用OpenGL程序创建动画效果,这里我们利用前面的例子,绘制正方形,并使这个正方形在窗口的边框反弹.这里需要创建一个循环,在每次调用显示回调函数之前改 ...

  6. MyBatis学习之输入输出类型

    1.  传递pojo对象 Mybatis使用ognl表达式解析对象字段的值,#{}或者${}括号中的值为pojo属性名称,其中,#{}:占位符号,好处防止sql注入,${}:sql拼接符号, 简要说明 ...

  7. vue2.0在table中实现全选和反选

    其实在去年小颖已经写过一篇:Vue.js实现checkbox的全选和反选 小颖今天在跟着慕课网学习vue的过程中,顺便试试如何在table中实现全选和反选,页面的css样式是直接参考慕课网的样式写的, ...

  8. sencha touch Container

    Container控件是我们在实际开发中最常用的控件,大部分视图控件都是继承于Container控件,了解此控件能帮我们更好的了解sencha touch. layout是一个很重要的属性,能够帮助你 ...

  9. tornado 数据库操作

    tornado是python的web框架,web程序开发中数据库操作是必须的. 安装: tornado的官方文档中提供的说明比较少,而且提供的模块中未找到数据库方面的模块,难道没有针对数据库操作进行封 ...

  10. Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')

    The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo ty ...