Modifying columns of very large mysql tables with little or no downtime

I periodically need to make changes to tables in mysql 5.1, mostly adding columns. Don’t. No really. Just don’t. It should be a very rare occasion when this is ever necessary. Assuming your data really is normalized to start with, the right way to solve the problem is to add a new table with a … Read more

What can user do with VIEW SERVER STATE permissions?

Read Dynamic Management Views and Functions Dynamic management views and functions return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance. There are two types of dynamic management views and functions: Server-scoped dynamic management views and functions. These require VIEW SERVER STATE permission on … Read more

MySQL: creating a user that can connect from multiple hosts

If you want to restrict to host and do not want to specify based on a subnet or wildcard using %, that’s the only way to do it. More details are available in the MySQL documentation. I am still trying to find ways to eliminate overhead when managing authentication to large MySQL installations and have … Read more

Changing host permissions for MySQL users

If you’ve got access to the mysql database, you can change the grant tables directly: UPDATE mysql.user SET Host=”%” WHERE Host=”localhost” AND User=”username”; …and an analogous UPDATE-statement to change it back. Also you might need to make changes to the mysql.db table as well: UPDATE mysql.db SET Host=”%” WHERE Host=”localhost” AND User=”username”; and then flush … Read more

How can I export the privileges from MySQL and then import to a new server?

Do not mess with the mysql db. There is a lot more going on there than just the users table. Your best bet is the “SHOW GRANTS FOR” command. I have a lot of CLI maintenance aliases and functions in my .bashrc (actually my .bash_aliases that I source in my .bashrc). This function: mygrants() { … Read more