Home Database Mysql Tutorial mysql 更改root密码_MySQL

mysql 更改root密码_MySQL

May 30, 2016 pm 05:10 PM
password

方法一

使用phpmyadmin这是最简单的了修改mysql库的user表

不过别忘了使用PASSWORD函数。

 

方法二

使用mysqladmin这是前面声明的一个特例。

mysqladmin -u root -p password mypasswd

输入这个命令后需要输入root的原密码然后root的密码将改为mypasswd。

把命令里的root改为你的用户名你就可以改你自己的密码了。

当然如果你的mysqladmin连接不上mysql server或者你没有办法执行mysqladmin

那么这种方法就是无效的。

而且mysqladmin无法把密码清空。

 

下面的方法都在mysql提示符下使用且必须有mysql的

方法三

mysql> INSERT INTO mysql.user (Host,User,Password)

VALUES(%,jeffrey,PASSWORD(iscuit));

mysql> FLUSH PRIVILEGES

确切地说这是在增加一个用户用户名为jeffrey密码为biscuit。

在里有这个例子所以我也就写出来了。

注意要使用PASSWORD函数然后还要使用FLUSH PRIVILEGES。

 

方法四

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

mysql> REPLACE INTO mysql.user (Host,User,Password)

VALUES(%,jeffrey,PASSWORD(iscuit));

mysql> FLUSH PRIVILEGES

 

方法五

使用SET PASSWORD语句

mysql> SET PASSWORD FOR jeffrey@"%" = PASSWORD(iscuit);

你也必须使用PASSWORD()函数

但是不需要使用FLUSH PRIVILEGES。

 

方法六

使用GRANT ... IDENTIFIED BY语句

mysql> GRANT USAGE ON *.* TO jeffrey@"%" IDENTIFIED BY iscuit;

这里PASSWORD()函数是不必要的也不需要使用FLUSH PRIVILEGES。

注意 PASSWORD() [不是]以在Unix口令加密的同样方法施行口令加密。

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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 solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? Apr 11, 2024 am 09:10 AM

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

How to set router WiFi password using mobile phone (using mobile phone as tool) How to set router WiFi password using mobile phone (using mobile phone as tool) Apr 24, 2024 pm 06:04 PM

Wireless networks have become an indispensable part of people's lives in today's digital world. Protecting the security of personal wireless networks is particularly important, however. Setting a strong password is key to ensuring that your WiFi network cannot be hacked by others. To ensure your network security, this article will introduce in detail how to use your mobile phone to change the router WiFi password. 1. Open the router management page - Open the router management page in the mobile browser and enter the router's default IP address. 2. Enter the administrator username and password - To gain access, enter the correct administrator username and password in the login page. 3. Navigate to the wireless settings page - find and click to enter the wireless settings page, in the router management page. 4. Find the current Wi

How to use Passkey for your Microsoft account How to use Passkey for your Microsoft account Feb 19, 2024 am 11:03 AM

Passkey is a more advanced and secure way to log in and can be used with a Microsoft account. This article will guide you how to use Passkey in your Microsoft account, introduce its advantages and the differences with passwords. Before we get into the details, we emphasize that if you frequently forget your passwords or need to log in quickly, Passkey will generally be better for you. What is Passkey? How are they different from passwords? Passwords are an advanced and secure authentication method that can replace traditional password logins. Each application has a unique key, ensuring security and preventing threats like phishing. Users can confirm their identity via email and password, or use facial recognition, fingerprint or security key

Incorrect password, beware BitLocker warning Incorrect password, beware BitLocker warning Mar 26, 2024 am 09:41 AM

This article will explore how to solve the problem of wrong password, especially the need to be careful when dealing with BitLocker warnings. This warning is triggered when an incorrect password is entered multiple times in BitLocker to unlock the drive. Usually, this warning occurs because the system has a policy that limits incorrect login attempts (usually three login attempts are allowed). In this case, the user will receive an appropriate warning message. The complete warning message is as follows: The password entered is incorrect. Please note that continuously entering incorrect passwords will cause the account to be locked. This is to protect the security of your data. If you need to unlock your account, you will need to use a BitLocker recovery key. The password is incorrect, beware the BitLocker warning you receive when you log in to your computer

How to Remove Windows 10 Lock Screen Password Now How to Remove Windows 10 Lock Screen Password Now Jan 09, 2024 pm 03:33 PM

After upgrading the win101909 system, some friends may want to cancel their computer lock screen password. If you don’t know what to do, I think we can find the account options in the computer’s settings window. Let’s take a look at the specific methods. How to cancel the lock screen password in win101909: 1. First press Win+I to open the settings interface. 2. Then find the account--login option, and then set it as shown. How to cancel power-on password login in win101909: 1. Execute regedit during running to open the registry and navigate to the following path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\Cu

Tutorial on changing wifi password on mobile phone (simple operation) Tutorial on changing wifi password on mobile phone (simple operation) Apr 26, 2024 pm 06:25 PM

Wireless networks have become an indispensable part of our lives with the rapid development of the Internet. In order to protect personal information and network security, it is very important to change your wifi password regularly, however. To help you better protect your home network security, this article will introduce you to a detailed tutorial on how to use your mobile phone to change your WiFi password. 1. Understand the importance of WiFi passwords. WiFi passwords are the first line of defense to protect personal information and network security. In the Internet age, understanding its importance can better understand why passwords need to be changed regularly. 2. Confirm that the phone is connected to wifi. First, make sure that the phone is connected to the wifi network whose password you want to change before changing the wifi password. 3. Open the phone’s settings menu and enter the phone’s settings menu.

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 hash passwords in Python? How to hash passwords in Python? Aug 26, 2023 pm 06:57 PM

Protecting user passwords is an important aspect of application development. One of the best ways to protect your passwords is to utilize hashing. Hashing is the process of converting a plain text password into an inconvertible, fixed-length sequence of characters. In this article, we will look at how to hash passwords in Python, discussing the language constructs and calculations involved. We will also provide two real executable code examples to demonstrate different password hashing methods. Syntax In order to hash passwords in Python, we will make use of the hashlib module, which provides different hashing algorithms. The basic sentence structure for hashing a secret phrase using hashlib is as follows - importhashlibpassword="my_pa

See all articles