Home Database Mysql Tutorial MySQL修改密码方案汇总

MySQL修改密码方案汇总

Jun 07, 2016 pm 02:52 PM
mysql Revise password database plan Summary along with

随着MySQL 数据库的广泛应用,MySQL 修改密码也随之出现,我们大家都知道MySQL 密码在实际应用中是经常需要修改的,以下的文章主要讲述的是MySQL 修改密码方案总结,望你能有所收获。 MySQL(和PHP搭配之最佳组合)是一个真正的多用户、多线程SQL数据库服务器

  随着MySQL 数据库的广泛应用,MySQL 修改密码也随之出现,我们大家都知道MySQL 密码在实际应用中是经常需要修改的,以下的文章主要讲述的是MySQL 修改密码方案总结,望你能有所收获。

  MySQL(和PHP搭配之最佳组合)是一个真正的多用户、多线程SQL数据库服务器。

  MySQL(和PHP搭配之最佳组合)是以一个客户机/服务器结构的实现,它由一个服务器守护程序MySQL(和PHP搭配之最佳组合)d和很多不同的客户程序和库组成。由于其源码的开放性及稳定性,且与网站流行编?挥镅?PHP的完美结合,现在很多站点都利用其当作后端数据库,使其获得了广泛应用。

  处于安全方面的考虑,需要为每一用户赋于对不同数据库的访问限制,以满足不同用户的要求。下面就分别讨论,供大家参考。

  一、MySQL修改密码方法总结

  首先要说明一点的是:一般情况下,修改MySQL(和PHP搭配之最佳组合)密码是需要有MySQL(和PHP搭配之最佳组合)里的root权限的,这样一般用户是无法更改密码的,除非请求管理员帮助修改。

  方法一

  使用phpMyAdmin (图形化管理MySQL(和PHP搭配之最佳组合)数据库的工具),这是最简单的,直接用SQL语句修改MySQL(和PHP搭配之最佳组合)数据库库的user表,不过别忘了使用PASSWORD函数,插入用户用Insert命令,修改用户用Update命令,删除用Delete命令。在本节后面有数据表user字段的详细介绍。

  方法二

  使用MySQL(和PHP搭配之最佳组合)admin。输入

  MySQL(和PHP搭配之最佳组合)admin -u root -p oldpassword newpasswd

  执行这个命令后,需要输入root的原密码,这样root的密码将改为newpasswd。同样,把命令里的root改为你的用户名,你就可以改你自己的密码了。 当然如果你的MySQL(和PHP搭配之最佳组合)admin连接不上MySQL(和PHP搭配之最佳组合) server,或者你没有办法执行MySQL(和PHP搭配之最佳组合)admin,那么这种方法就是无效的,而且MySQL(和PHP搭配之最佳组合)admin无法把密码清空。

  下面的方法都在MySQL(和PHP搭配之最佳组合)提示符下使用,且必须有MySQL(和PHP搭配之最佳组合)的root权限:

  MySQL修改密码方法三

  MySQL(和PHP搭配之最佳组合)> INSERT INTO MySQL(和PHP搭配之最佳组合).user (Host,User,Password) VALUES (’%’,’system’, PASSWORD(’manager’));

  MySQL(和PHP搭配之最佳组合)> FLUSH PRIVILEGES

  确切地说这是在增加一个用户,用户名为system,密码为manager。注意要使用PASSWORD函数,然后还要使用FLUSH PRIVILEGES来执行确认。

  方法四

  和方法三一样,只是使用了REPLACE语句

  MySQL(和PHP搭配之最佳组合)> REPLACE INTO MySQL(和PHP搭配之最佳组合).user (Host,User,Password)

  VALUES(’%’,’system’,PASSWORD(’manager’));

  MySQL(和PHP搭配之最佳组合)> FLUSH PRIVILEGES

  方法五

  使用SET PASSWORD语句

  MySQL(和PHP搭配之最佳组合)> SET PASSWORD FOR system@"%" = PASSWORD(’manager’);

  你也必须使用PASSWORD()函数,但是不需要使用FLUSH PRIVILEGES来执行确认。

  MySQL修改密码方法六

  使用GRANT ... IDENTIFIED BY语句,来进行授权。

  MySQL(和PHP搭配之最佳组合)> GRANT USAGE ON *.* TO system@"%" IDENTIFIED BY ’manager’;

  这里PASSWORD()函数是不必要的,也不需要使用FLUSH PRIVILEGES来执行确认。

  注:PASSWORD()函数作用是为口令字加密,在程序中MySQL(和PHP搭配之最佳组合)自动解释。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

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 optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

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.

What should I do if my Win10 password does not meet the password policy requirements? What to do if my computer password does not meet the policy requirements? What should I do if my Win10 password does not meet the password policy requirements? What to do if my computer password does not meet the policy requirements? Jun 25, 2024 pm 04:59 PM

In the Windows 10 system, the password policy is a set of security rules to ensure that the passwords set by users meet certain strength and complexity requirements. If the system prompts that your password does not meet the password policy requirements, it usually means that your password does not meet the requirements set by Microsoft. standards for complexity, length, or character types, so how can this be avoided? Users can directly find the password policy under the local computer policy to perform operations. Let’s take a look below. Solutions that do not comply with password policy specifications: Change the password length: According to the password policy requirements, we can try to increase the length of the password, such as changing the original 6-digit password to 8-digit or longer. Add special characters: Password policies often require special characters such as @, #, $, etc. I

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

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.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

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.

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

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.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

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

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

See all articles