SHOW STATUS LIKE ‘Qcache%’; nJoy 😉
Tag: Mysql
Node.js handling mysql disconnects.
You may lose the connection to a MySQL server due to network problems, the server timing you out, the server being restarted, or crashing. All of these events are considered fatal errors, and will have the err.code = ‘PROTOCOL_CONNECTION_LOST’. See the Error Handling section for more information. A good way to handle such unexpected disconnects is shown below:…
Mysql list privileges for a user
SHOW GRANTS; SHOW GRANTS FOR CURRENT_USER; SHOW GRANTS FOR CURRENT_USER(); e.g. SHOW GRANTS FOR root; mysql> SHOW grants for root; +———————————————————————————-+ | Grants for root@% | +———————————————————————————-+ | GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY PASSWORD ‘*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B’ WITH GRANT OPTION | +———————————————————————————-+ 1 row in set (0.00 sec) mysql> nJoy 😉
When a MySQL table was last updated?
Simply do this: SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = ‘dbname’ AND TABLE_NAME = ‘tabname’ nJoy 😉
Reset Mysql password from bash prompt
You can recover MySQL database server password with following five easy steps. Step # 1: Stop the MySQL server process. Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password. Step # 3: Connect to mysql server as the root user. Step # 4:…
Monitoring a bottleneck with strace
If let’s say Mysql is slow at performing a task you can check what is the bottleneck using strace to attach to the process. <span style="color: #00ff00;">$ ps -ef|grep -i mysql</span> Identify the process id then <span style="color: #00ff00;">$ strace -cp <pid></span> Leave it 10 seconds or a minute then ^C. That will tell you where…
MySQL: Grant **all** privileges on database
At mysql prompt as root user: Â GRANT ALL privileges ON *.* TO ‘user’@’machine.lan’ IDENTIFIED BY ‘password’ WITH GRANT OPTION; Â FLUSH PRIVILEGES; That’s all
How to install MySQL on CentOS
Here are the steps of what you need to do in order to install and setup MySQL on a new server. We’ll prepare a fresh CentOS 6 system (64 bit) for use as a database server. All you need is access to an SSH client and your server root credentials. Preparing the System The…
Allow remote SQL connection to Mysql from any host
Allowing the login of a user from any host in Mysql is simple: mysql> select host, user from mysql.user; +—————+——+ | host | user | +—————+——+ | 127.0.0.1 | root | | localhost | root | | minimal01.lan | root | +—————+——+ 3 rows in set (0.00 sec) mysql> update mysql.user set host=’%’ where host=’127.0.0.1′;…