My current installation of mySQL/phpMyAdmin on my ubuntu server is refusing to allow any user to be created with any password I have tried. The error is always:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
I have never had this error before with other installations of mysql, on server and xampp/localhost both. This is a new server installation however.
For example, on the mysql terminal on the command line, any attempt to create a user (with extremely random passwords) fails
mysql> CREATE USER 'ses'#'%' IDENTIFIED BY 'yIO8v3hVai0zosaD';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER 'ses'#'%' IDENTIFIED BY 'yIO8v3hVai0zosaDyIO8v3hVai0zosaDyIO8v3hVai0zosaD';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Same thing with phpMyAdmin
With the following error at the bottom
Warning in ./libraries/dbi/DBIMysqli.class.php#261
mysqli_query(): (HY000/1819): Your password does not satisfy the current policy requirements
Backtrace
./libraries/dbi/DBIMysqli.class.php#261: mysqli_query(
object,
string 'SELECT PASSWORD(\'rSxYcnCcO2fhhKgD\') AS `password`;',
integer 0,
)
./libraries/DatabaseInterface.class.php#244: PMA_DBI_Mysqli->realQuery(
string 'SELECT PASSWORD(\'rSxYcnCcO2fhhKgD\') AS `password`;',
object,
integer 1,
)
./libraries/DatabaseInterface.class.php#1944: PMA_DatabaseInterface->tryQuery(
string 'SELECT PASSWORD(\'rSxYcnCcO2fhhKgD\') AS `password`;',
object,
integer 1,
boolean false,
)
./libraries/server_privileges.lib.php#5055: PMA_DatabaseInterface->fetchSingleRow(string 'SELECT PASSWORD(\'rSxYcnCcO2fhhKgD\') AS `password`;')
./libraries/server_privileges.lib.php#5179: PMA_getHashedPassword(string 'rSxYcnCcO2fhhKgD')
./libraries/server_privileges.lib.php#4176: PMA_getSqlQueriesForDisplayAndAddUser(
string 'test-accountdb',
string '%',
string '',
)
./server_privileges.php#167: PMA_addUser(
NULL,
string 'test-accountdb',
string '%',
NULL,
boolean true,
)
Edit: Added results for the mysql validate_password% variables
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
This is the Validate Password Plugin at work. It was introduced in MySQL 5.6.6.
According to the values returned from the SHOW VARIABLES LIKE 'validate_password%'; you're missing a single special character in your password as indicated by validate_password_special_char_count | 1.
Add a special character such as $ or * to this password yIO8v3hVai0zosaD you'll be able to create the user.
Procedure 1:
Step1: Log in with root user ane and password
Step2: run bellow command in Sql terminal
uninstall plugin validate_password
Step3 : create a new user with whatever password you want
Step4: run bellow command in Sql terminal
INSTALL PLUGIN validate_password SONAME 'validate_password.so';
Step5: Checkout now your username & password by login
Procedure 2:
Add a special character such as $ or * to this password icluding other cases like digit,small case character, uper case character
Related
Install MySQL using mysql57-community-release-el7-7.noarch.rpm
started the MySQL server using service mysqld start
when I try to connect MySQL or any other client app on the localhost I get.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I never set an admin password not sure what is the default and what am I missing.
First you will have to reset the password,in some cases theres no need to enter any password simply press Enter when prompted and then you can change the password using ALTER USER command,but if it doesn't works Go through the following procedure,
First you will have to get the temporary password , type in the terminal :
grep 'temporary password' /var/log/mysqld.log
You will get a temporary password at the end of the sentence, login to mysql using that temporary password as
mysql -u root -p
Enter Password : (Enter you Temporary password Here)
Now you will have to change the default password, for that you will have to go through some rules.
NOTE: Type the following command inside mysql
mysql> SHOW VARIABLES LIKE 'validate_password%';
You will get a table like :
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
For minimal validation, type(optional you can change it anytime)
mysql> SET GLOBAL validate_password_length=6;
mysql> SET GLOBAL validate_password_policy=LOW;
This will check for minimum 6 digit password
Now you can change the default password,
For E.g if you want to set 123456 as your new password
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY '123456';
Hope it will solve your problem.
Check /var/log/messages for more details.
I am trying to import some data from mysql to hive via sqoop. It works when both sqoop and mysql db are on the same host, otherwise it fails. This is the query I am executing.
[user#xyz ~]$ sqoop import --connect "jdbc:mysql://abc.something.com/test" --username user --password pass --table dataSql --hive-import --hive-table test.dataHive --target-dir /tmp/sqoop$RANDOM
Please note that I am currently on host xyz and I am trying to connect to a mysql db on host abc. Following are the error I see.
ERROR: org.apache.sqoop.manager.SqlManager - Error executing statement: java.sql.SQLException: Access denied for user 'user'#'xyz.something.com' (using password: YES)
.
.
.
ERROR: org.apache.sqoop.manager.CatalogQueryManager - Failed to list columns java.sql.SQLException: Access denied for user 'user'#'xyz.something.com' (using password: YES)
.
.
.
and so on. My question is, why is my machine appending its hostname to username ('user'#'xyz.something.com')? How do I solve it?
When sqoop and mysql are on the same host, most likely the ip source is localhost, on the remote host this is not longer true and you get access denied.
Log into mysql and do this query:
mysql> select user, host from user;
+------------+---------------------+
| user | host |
+------------+---------------------+
| amon | % |
| cm | % |
| hive | % |
| hue | % |
| nav | % |
| navms | % |
| oozie | % |
| retail_dba | % |
| rman | % |
| sentry | % |
| root | 127.0.0.1 |
| root | localhost |
| root | quickstart.cloudera |
+------------+---------------------+
check if your user name user is into this table and has % (any) as hostname or xyz.something.com. It your user is not in this table you need to add it:
mysql> create user 'test'#'%' identified by 'password';
mysql> grant select privileges on *.* to 'test'#'%';
mysql> flush privileges;
Sqoop import data from mysql to hive, it will use jdbc interface which connects mysql with mysql-connect-j.
When I use mysql-connector-java-5.1.9.jar, it also has this problem. And I replace it with mysql-connector-java-5.1.38.jar, then sqoop works fine.
MySQL connections can be restricted to specific users connecting from specific hosts.
In this case I suspect that the GRANT command was applied to 'some_user#localhost' so that remote connections are blocked...
Have a look at the answers to that post to get the idea.
'user'#'xyz.something.com' this is actually the user that visit the DB.
As your sqoop host is xyz, the "user" from machine "xyz" is visiting the machine "abc", but the password is wrong (or maybe there isn't a "user" from machine "xyz" is allowed to visit "abc"), so the DB from the "abc" throw out this error and "xyz" sqoop print this message.
Hope this gonna help.
The --username user --password pass here specifies the user credentials given access to use the test database, it is not for the mysql as a whole. So modify this accordingly.
using npm any-db and any-db-mysql
var db = anyDB.createConnection('mysql://db_user:921F9DB7pnn0ka777#localhost/db1',function(e,r){if(e){console.log('db.err: '+e);}}); // also tried 127.0.0.1
I should see the console log
db.err: null
But I don't. (I see no error at all).
db.query("SELECT * FROM btns WHERE id='1'").on('row',function(e,r){
console.log('err: '+e);
console.dir(r);
});
The above also prints nothing (not even an error);
In my ssh session mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| db1 |
| test |
+--------------------+
mysql> use db1;
mysql> show tables;
+---------------------------+
| Tables_in_db1 |
+---------------------------+
| btns |
+---------------------------+
The db_user is in database 'mysql', setup like so:
mysql> use mysql;
mysql> update user set password=PASSWORD('921F9DB7pnn0ka777') where user='db_user';
mysql> flush privileges;
mysql> exit;
Why would you expect the first case to ever output anything? You're only logging if the error argument is a truthy value (which null is not).
For the the second case, any-db/any-db-mysql does not emit 'row' events for the streaming (non-callback) version. The streaming version returns a readable stream, so you need to use standard methods for getting data from a readable stream (in object mode):
Listen for 'data' events where the 'data' event handler's argument is a row object.
OR call .read() repeatedly to get row objects
Also for the streaming version, you can listen for an 'error' event to check for errors.
I am having issues with user privileges in mysql and cloudfoundry.
I was able to insert data into a table and I am trying to insert data into another table and running into the following issue:
mysql> source /home/julien/Documents/donnees/projets/Site-Rencontres/java/src/main/resources/misc/sql/geolocation.sql
ERROR 1142 (42000): INSERT command denied to user 'uEs8kO1Aqdhlr'#'172.30.49.208' for table 'geolocation'
Can anyone please clarify to me how user privileges work on mysql for cloudfoundry?
EDIT 1: Some info:
+-------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for uEs8kO1Aqdhlr#% |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'uEs8kO1Aqdhlr'#'%' IDENTIFIED BY PASSWORD '*A826C24476F83F907DC66060E4C2705D92E151ED' WITH MAX_USER_CONNECTIONS 20 |
| GRANT ALL PRIVILEGES ON `de2474fdd53114ebfbb17b3c236676a28`.* TO 'uEs8kO1Aqdhlr'#'%' |
+-------------------------------------------------------------------------------------------------------------------------------------------+
EDIT 2: Some more info:
mysql> select user();
+-----------------------------+
| user() |
+-----------------------------+
| uEs8kO1Aqdhlr#172.30.49.208 |
+-----------------------------+
1 row in set (0.80 sec)
mysql> select current_user();
+-----------------+
| current_user() |
+-----------------+
| uEs8kO1Aqdhlr#% |
+-----------------+
1 row in set (0.85 sec)
EDIT 3: Yet some more info:
I realized that my sql script was referring the wrong schema (here called dummy):
insert into dummy.geolocation
Removing the "dummy." allowed me to run the script without any error. Why this gave me the above error I am not sure. If any one can explain, that would be useful...
CF provisions both the mysql instance as well as a database. Therefore when you bind a mysql service you actually bind the database to your app. If you notice when vmc tunnelling to the mysql service, it gives you the username/password as well as a key called "name", that is the schema name the tunnel is on. Operations against other schemas would be considered out of the CF account used.
Does MySQL have built in function to get host name?
Similar to
select user(); //this returns user#userip
Edit:
select current_user(); //returns user#10.0.3.%
Last symbol is % -- why?
SELECT ##hostname;
--mysql 4.1 didn't have this one.
select current_user(); returns user#10.0.3.% last simbol is % why ??
the % is the record in mysql.user that match your current login
which can be derived from
select concat(user, '#', host) from mysql.user;
the % is determined by host value.
wouldn't his work?
select substring_index(user(),'#', -1) as hostname;
The above is wrong, it returns the user's IP not host's. I was fooled by testing on local. Sorry about that.
I guess this returns host name, but this wouldn't be useful unless you are ready to grep, pipe and cut Just a FYI:
C:\>mysqladmin -u username -pmypassword -h dev.naishelabs.com version
mysqladmin Ver 8.41 Distrib 5.0.22, for Win32 on ia32
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.77
Protocol version 10
Connection dev.naishelabs.com via TCP/IP
TCP port 3306
Uptime: 73 days 5 hours 7 min 45 sec
If you want the hostname of the database server, you can use SHOW VARIABLES:
mysql> SHOW VARIABLES LIKE 'hostname';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| hostname | munda |
+---------------+-------+
1 row in set (0.00 sec)
It's not a built-in function so it can't be used in a SELECT statement.
Are you looking for CURRENT_USER function.
Returns the user name and host name
combination for the MySQL account that
the server used to authenticate the
current client. This account
determines your access privileges.
The value of CURRENT_USER() can differ
from the value of USER().
You can use user() and current_user() functions. If you want only hostname do something like select substr(current_user(),LOCATE('#', current_user())+1) AS localhost;
You can find details here
The ##hostname variable contains the system hostname:
$ cat /etc/hostname
bruno
$ hostname
bruno
$ mysql
mysql> SELECT ##hostname;
+------------+
| ##hostname |
+------------+
| bruno |
+------------+
Note that this can be combined and used in other queries:
mysql> SELECT name, ##hostname FROM people;
+-------+-------------+
| name | ##hostname |
+-------+-------------+
| Dotan | bruno |
+-------+-------------+
mysql> SELECT CONCAT('I am on server ', ##hostname);
+---------------------------------------+
| CONCAT('I am on server ', ##hostname) |
+---------------------------------------+
| I am on server bruno |
+---------------------------------------+