ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘demo’

不管输入什么都是提示权限不够

mysql> create database sufadi;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'sufadi'

原因

默认情况是匿名用户登陆,所以我们需要设置一个密码,然后每次需要登陆以下并进入

D:\python3-webapp-Su\www>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.6.24 MySQL Community Server (GPL)Copyright (c) 2000, 2015, 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.

设置密码

管理员身份运行

进入安装目录的bin文件,右键选择管理员身份运行mysql.exe

设置密码

UPDATE user SET Password=PASSWORD(‘123456’) WHERE user=’root’;

mysql> UPDATE user SET Password=PASSWORD('123456') WHERE user='root';
Query OK, 3 rows affected (0.03 sec)
Rows matched: 3  Changed: 3  Warnings: 0

刷新一下

flush privileges;

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

cmd窗口重新登陆一下

mysql -u root -p

输入密码

C:\Users\admin>mysql -u root -p
Enter password:

登陆成功

C:\Users\admin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.6.24 MySQL Community Server (GPL)Copyright (c) 2000, 2015, 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> create database pythondb;
Query OK, 1 row affected (0.01 sec)

show databases

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| demo               |
| mysql              |
| performance_schema |
| pythondb           |
| sufadi             |
| test               |
+--------------------+
7 rows in set (0.00 sec)

ERROR 1044 (42000)Access denied for user @localhost to database相关推荐

  1. error 1044 (42000):access denied for user ''@'localhost' to database 'mysql' 解决方法

    重新安装mariaDB数据库时,出现安装权限问题,中止安装发现居然能够登陆mysql,但是登陆时可以不填密码,操作数据库时会报错:ERROR 1044 (42000): Access denied f ...

  2. Mysql,ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

    ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 刚在服务器上装上mysql,发现以root加 ...

  3. ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

    提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.前两天也出现过这个问题,网上找了一个比 ...

  4. error 1044 (42000):access denied for user ''@'localhost' to database 'mysql'

    重新安装mariaDB数据库时,出现安装权限问题,中止安装发现居然能够登陆mysql,但是登陆时可以不填密码,操作数据库时会报错:ERROR 1044 (42000): Access denied f ...

  5. 创建数据库 mysql 1044_mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database...

    1. 问题描述: 在MySQL控制台下创建数据库出现以下信息: mysql> CREATE DATABASE python; ERROR 1044 (42000): Access denied ...

  6. 解决 ERROR 1044 (42000): Access denied for user ‘‘@‘localhost‘ to database ‘mysql‘

    然后创建一个数据库,提示下图错误: 提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.是 ...

  7. 解决忘记密码报错ERROR 1044 (42000): Access denied for user ‘‘@‘localhost‘ to database ‘mysql‘的办法

    由于长时间没用登录mysql忘记密码报错,ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql',导 ...

  8. error 1044 mysql_mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database

    1. 问题描述: 在MySQL控制台下创建数据库出现以下信息: mysql> CREATE DATABASE python; ERROR 1044 (42000): Access denied ...

  9. 终于解决 ERROR 1044(42000): Access denied for user ''@'localhost' to database,亲测有效

    在 create database mytestsql 时出现错误: ERROR 1044(42000): Access denied for user ''@'localhost' to datab ...

最新文章

  1. 支持向量机(SVM)
  2. Spring Security 实战:自定义异常处理
  3. Linux中使用Linux的vim如何让代码高亮显示
  4. ArcGIS Server for Silverlight 之集群(Simple Clusterer)
  5. 51nod 2497 数三角形
  6. Make Games with Python Pygame (2)
  7. 在Ubuntu上安装RealPlayer的方法
  8. PHP-FPM 与 Nginx 的通信机制总结
  9. TellDontAsk的扩展
  10. Ui设计中的动画如何应用,你知道吗?
  11. iOS及Mac开源项目和学习资料【超级全面】
  12. Zigbee之旅(十):综合小实验——基于CC2430的温度监测系统(转)
  13. 呕心沥血大放血,今天小企鹅来给大家送福利了!!!Mac.Win.Lin虚拟机映像/资源超全[分享]
  14. larvel html转pdf文件,如何在Laravel中使用TCPDF从HTML生成PDF
  15. mac os操作系统如何降级
  16. python 爬取《延禧攻略》所有的演员参演的电视剧
  17. iOS 屏幕尺寸、分辨率、适配
  18. 昆石VOS3000_2.1.3.2完整安装包及安装脚本
  19. 【开发一个简单的音乐播放器+服务端】【一】
  20. 密码算法详解——AES

热门文章

  1. android开发利用传感器实现微信的摇一摇功能
  2. 关于设备像素比dpr的理解
  3. 抖音和tiktok是什么关系?TikTok和抖音差别大吗?
  4. 剑网3一直连接不上服务器,win10系统剑网3连不上服务器的解决方案
  5. python实现树莓派监控_树莓派上安装pyaudio 及 对声音实时监控
  6. Python——永久存储:腌制一缸美味的泡菜
  7. 贝格尔编排法的PHP实现
  8. 使用ffmpeg的调色板对图片压缩
  9. 将加密的ppt文档解密,使之可以编辑
  10. u8的汇兑损益的计算公式_C程序计算损益