Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a six character password in MySQL 5.7

I need to create a user with a six character password in new MySQL on my mac. I know that the lowest setting in 5.7 will allows only eight characters. Is there any way to go around that?

I type in CREATE USER 'newsier'@'localhost' IDENTIFIED BY 'special'

It outputs the error

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
like image 601
user3703723 Avatar asked Jan 21 '16 00:01

user3703723


People also ask

How can I set password in MySQL?

In the mysql client, tell the server to reload the grant tables so that account-management statements work: mysql> FLUSH PRIVILEGES; Then change the 'root'@'localhost' account password. Replace the password with the password that you want to use.

What is password data type in MySQL?

MySQL password() returns a binary string from a plain text password. The function returns NULL if the string supplied as the argument was NULL. MySQL server uses this function to encrypt MySQL passwords for storage in the Password column of the user grant table. Syntax: PASSWORD(string);

How do I start MySQL username and password?

Replace [username] with the username for your MySQL installation. Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.


1 Answers

First you login with mysql -u root -p and check the current policy rules by:

# SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_dictionary_file    |        |
| validate_password_length             | 5      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

Then you can change any of the above variables at your will:

# SET GLOBAL validate_password_length = 5;
# SET GLOBAL validate_password_number_count = 0;
# SET GLOBAL validate_password_mixed_case_count = 0;
# SET GLOBAL validate_password_special_char_count = 0;

Finally you can create a database and a user accessing it with a simpler password:

# CREATE DATABASE test1;
# GRANT ALL PRIVILEGES ON test1.* TO user1@localhost IDENTIFIED BY "pass1";
# FLUSH PRIVILEGES;

After that you can login with mysql -u user1 -p test1 using password pass1

like image 62
Alexander Farber Avatar answered Sep 24 '22 18:09

Alexander Farber