Unable to set password of myphpadmin - mysql

The solutions those posts stated:
Adhere to the password policy.
uninstall plugin validate_password (which I don't want to do )
My password policy:
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| 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 |
Now I don't know what will satisfy the MySQL password validation plugin, I tried a ton of passwords that had all the requirements stated below, like
Ml9506&#, Qwerty123!##, qwertyQWERTY098)(* and a ton of more passwords.
I got this error while installing PHPMyAdmin:
MySQL ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
I also tried changing the policy to LOW but that also didn't help.

Set policy level to low.
mysql> SET GLOBAL validate_password_policy=LOW;
OR
mysql> SET GLOBAL validate_password_policy=0;
check password validation policy level with:
$ SHOW VARIABLES LIKE 'validate_password%';
If the password policy doesn't change, exit from the MySQL prompt and restart the MySQL service from your Terminal window:
$ sudo systemctl restart mysql
then go to MySQL and create your user

Related

privilege for user in sql

I just create mysql 8.0.20 server on AWS RDS.
I'm try to change global varible.. on workbench or via the terminal..
and get this msg
Error Code: 1227. Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
but I have only one master user..
mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| admin | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| rdsadmin | localhost |
+------------------+-----------+
5 rows in set (0.16 sec)
I'm confused and don't understand who is the master.. (according to aws is admin)
I want to understand with which user I can add another or run some simple script like
SET GLOBAL innodb_lock_wait_timeout = 5000;

what is the best solutions to mysql connection timeout?

I am writing a small web app in Go, which uses mysql to store data.
I got intermittent mysql error if the web sever didn't get any request after some amount of time(> 8 hours):
[mysql] 2017/02/08 16:31:56 packets.go:33: unexpected EOF
[mysql] 2017/02/08 16:31:56 packets.go:130: write tcp 127.0.0.1:49188->127.0.0.1:3306: write: broken pipe
I found some related discussion on github(issue 529, issue 257 and issue 446). From what I understand, mysql db would close the connection if timeout is reached.
I tried to set SetMaxOpenConns to 9 and SetMaxIdleConns to 0 as some people recommended. However, this threw exception immediately. (But if I set SetMaxIdleConns larger than 0, there was no immediate exception thrown)
I also tried to set SetConnMaxLifetime to 5 mins. This threw exception too after 5 mins.
Now I am trying the code below:
db.SetConnMaxLifetime(0)
db.SetMaxOpenConns(10)
db.SetMaxIdleConns(5)
It has been running for 20 mins. It's still too early to tell.
(UPDATE: this doesn't work either)
Here is configuration:
driver: go-sql-driver V1.3.
go version: go1.7.1 darwin/amd64
mysql: latest from docker hub
rkt version: 1.18
CoreOS: 1284.0.0
Perhaps you can start a heartbeat Goroutine to avoid timeout.
you can check your mysql time_wait variable:
mysql> show global variables like 'wait_timeout':
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 300 |
+---------------+-------+
1 row in set (0.00 sec)
then use db.SetConnMaxLifetime(120*time.Second), which mean when db connection is idle over than 120s, sql.db will reopen or get a new connection from db pool by db.Open. If you not set connection max life time, you maybe use a closed connection and got the error.
watching the mysql process list,mysql> show processlist;,if connection sleep over than 300s,it's recycled by mysql:
mysql> show processlist;
+-------+-----------------+------------------+-------------+---------+---------+------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+-----------------+------------------+-------------+---------+---------+------------------------+------------------+
| 4 | event_scheduler | localhost | NULL | Daemon | 1363480 | Waiting on empty queue | NULL |
| 26539 | root | 172.17.0.1:48732 | NULL | Query | 0 | starting | show processlist |
| 26575 | auditcenter | 172.17.0.1:51714 | obs_gb_test | Sleep | 51 | | NULL |
+-------+-----------------+------------------+-------------+---------+---------+------------------------+------------------+
3 rows in set (0.00 sec)
SetMaxOpenConns and SetMaxIdleConns is used for setting connection resource, see enter link description here

Show number of connections to a specific database [duplicate]

With administrative permissions im mysql, how can I see all the open connections to a specific db in my server?
The command is
SHOW PROCESSLIST
Unfortunately, it has no narrowing parameters. If you need them you can do it from the command line:
mysqladmin processlist | grep database-name
As well you can use:
mysql> show status like '%onn%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| Aborted_connects | 0 |
| Connections | 303 |
| Max_used_connections | 127 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 127 |
+--------------------------+-------+
7 rows in set (0.01 sec)
Feel free to use
Mysql-server-status-variables or Too-many-connections-problem
That should do the trick for the newest MySQL versions:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB like "%DBName%";
You can invoke MySQL show status command
show status like 'Conn%';
For more info read Show open database connections
SQL:
show full processlist;
This is what the MySQL Workbench does.
In MySql,the following query shall show the total number of open connections:
show status like 'Threads_connected';
If you're running a *nix system, also consider mytop.
To limit the results to one database, press "d" when it's running then type in the database name.
From the monitoring context here is how you can easily view the connections to all databases sorted by database. With that data easily monitor.
SELECT DB,USER,HOST,STATE FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY DB DESC;
+------+-------+---------------------+-----------+
| DB | USER | HOST | STATE |
+------+-------+---------------------+-----------+
| web | tommy | 201.29.120.10:41146 | executing |
+------+-------+---------------------+-----------+
If we encounter any hosts hots max connections and then not able to connect, then we can reset host tables by flushing it and is as follows:
FLUSH HOSTS;
In query browser right click on database and select processlist

PHPMyAdmin: No activity within 1800 seconds; please log in again error

I have logged into phpmyadmin and have about 15 tables. I click on the one table and the data structure page loads up. I click on another and it works fine as well. However, when clicking on a certain table, it logs me out of phpmyadmin and I get this error message:
No activity within 1800 seconds; please log in again
I logged back in again and every time I click the specific table, it's giving me the error message. No other tables are having this trouble.
Any reasons for the cause of this and how to fix.
Thanks
Hi I also got the same Issue. I solved it by adding below line to my config.inc.php i.e by extending my time limit from 1800 seconds to 86400 seconds
$cfg['LoginCookieValidity'] = 86400;
For more details Please Refer the below link and follow the instructions over there.Thankyou!
http://firstcode.info/php-no-activity-within-1800-seconds-error/
For starters, this happened to me when I clicked "reset" in the settings panel of PHPMyAdmin and then clicked "apply" while on the features tab, which basically set "Login cookie validity" to empty string.
Played around plenty with config files in /var/lib/phpmyadmin/, /usr/share/phpmyadmin/, and /etc/phpmyadmin/ but no changes to login cookie validity had any effect.
So I figured PHPMyAdmin must have saved this dreaded configuration in a database. So I did the following:
mysql -u root -p
Enter password:
mysql> USE phpmyadmin
Database changed
SHOW TABLES;
+------------------------+
| Tables_in_phpmyadmin |
+------------------------+
| pma__bookmark |
| pma__central_columns |
| pma__column_info |
| pma__designer_settings |
| pma__export_templates |
| pma__favorite |
| pma__history |
| pma__navigationhiding |
| pma__pdf_pages |
| pma__recent |
| pma__relation |
| pma__savedsearches |
| pma__table_coords |
| pma__table_info |
| pma__table_uiprefs |
| pma__tracking |
| pma__userconfig |
| pma__usergroups |
| pma__users |
+------------------------+
19 rows in set (0.00 sec)
SELECT * FROM pma__userconfig
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| username | timevalue | config_data |
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| root | 2020-10-14 10:02:23 | {"LoginCookieValidity":"","LimitChars":500,"SQLQuery\/Explain":false,"SQLQuery\/ShowAsPHP":false,"MaxTableList":"","Server\/hide_db":"","collation_connection":"utf8mb4_unicode_ci"} |
+---------------+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Sure enough, this is the bugger the config files weren't modifying. So I ran:
DELETE FROM pma__userconfig WHERE username='root'
Query OK, 1 row affected (0.00 sec)
FLUSH TABLES pma__userconfig
Then I restarted Apache for good measure:
sudo service apache2 restart
And voilà, all in the world was right again.

Trying to send mail alert for mysql

how to send mail alert for MySQL?
can we send alerts when the MySQL has large number of connections, or MySQL is not responding properly. Can someone help me to solve this prolem ?
You can do this in a number of ways. SHOW FULL PROCESSLIST; query would give you information about the number of connections as well as the queries being executed by each connection(thread). A sample result is as follows.
mysql> SHOW FULL PROCESSLIST;
+------+------+--------------------+------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+--------------------+------+---------+------+-------+-----------------------+
| 1298 | root | 192.168.1.76:37648 | NULL | Sleep | 0 | | NULL |
| 1491 | root | localhost | NULL | Query | 0 | init | show full processlist |
+------+------+--------------------+------+---------+------+-------+-----------------------+
If you are only concerned with the number of current connection(threads) you can use the following query.
mysql> SHOW STATUS WHERE `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 2 |
+-------------------+-------+
Now about the mail alerts, you can setup a cron job(shell script) to fire a mail alert as soon as the number of current connections exceed a certain limit. mail command can be used for this.
$ echo "Max MySQL Connections reached"| mail -s "your subject" your#email.com
Also, I came across a great MySQL Monitoring tool- MONyog. It would let you setup mail alerts for any of the MySQL variable.