mysql ERROR 1045 access denied for user 'root
操作系统:WINDOWS7 系统 数据库版本:mysql 5.1 提示: mysql ERROR 1045 access denied for user 'root'@'localhost' using password yes/no 通过localhost和127.0.0.1访问没有问题,用IP访问出现这个错误 1. 管理员登陆系统,停止 MySQL 服务或者结束 MyS
操作系统:WINDOWS7 系统
提示:mysql ERROR 1045 access denied for user 'root'@'localhost' using password yes/no
通过localhost和127.0.0.1访问没有问题,用IP访问出现这个错误
1. 管理员登陆系统,停止 MySQL 服务或者结束 MySQL 进程。
2. 启动 WINDOWS 的命令行窗口(即通常的 DOS 窗口:运行cmd),切换到你的 “MySQL\bin” 目录下。
例如我的是 “D:\Program Files\MySQL\MySQL Server 5.2\bin”,然后执行下面的粗体的命令:(注意你的 “my.ini” 位置)
Microsoft Windows XP [版本 5.1.2600]
C:\>cd D:\Program Files\MySQL\MySQL Server 5.2\bin
C:\>d:
D:\Program Files\MySQL\MySQL Server 5.2\bin>mysqld --defaults-file="D:\Program Files\MySQL\MySQL Server 5.2\my.ini" --console --skip-grant-tables
100608 9:04:12 InnoDB: Started; log sequence number 0 46409
100608 9:04:12 [Note] mysqld: ready for connections.Version: '5.2.0-falcon-alpha-community' socket: '' port: 3306 MySQL Community
Server (GPL)
100608 9:06:57 [Warning] Found invalid password for user: 'root@localhost'; Ign
oring user
只要出现上面信息,就说明 MySQL 已经起来了。
3. 不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “MySQL\bin” 目录下,然后执行下面的粗体的命令:
Microsoft Windows XP [版本 5.1.2600]
C:\>cd D:\Program Files\MySQL\MySQL Server 5.2\bin
C:\>d:
D:\Program Files\MySQL\MySQL Server 5.2\bin>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
然后,就是重新设置密码了!
mysql> UPDATE user SET Password=PASSWORD('root') where USER='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
4. 好了到此步,可以关闭第一个 DOS 窗口了(关闭服务)。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。
5. 在剩下的第二个 DOS 窗口中,用新的 ROOT 密码连接 MySQL。
D:\Program Files\MySQL\MySQL Server 5.2\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community-nt MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> quit
Bye
至此,系统恢复 ROOT 用户管理权限完成,就是管理员密码的问题,奇怪,官方安装的时候不给出解决方法,貌似已存在很久了。。。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

DeepSeek cannot convert files directly to PDF. Depending on the file type, you can use different methods: Common documents (Word, Excel, PowerPoint): Use Microsoft Office, LibreOffice and other software to export as PDF. Image: Save as PDF using image viewer or image processing software. Web pages: Use the browser's "Print into PDF" function or the dedicated web page to PDF tool. Uncommon formats: Find the right converter and convert it to PDF. It is crucial to choose the right tools and develop a plan based on the actual situation.

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

Oracle can read dbf files through the following steps: create an external table and reference the dbf file; query the external table to retrieve data; import the data into the Oracle table.
