Tag: privileges

MySQL

Restore the MySQL root user’s full privileges in Windows

1. Stop MySQL service. Run services.msc as administrator and stop it. 2. Run cmd.exe as administrator. 3. Execute: c:xamppmysqlbinmysqld.exe –skip-grant-tablesc:xamppmysqlbinmysqld.exe –skip-grant-tables 4. Run another cmd.exe as administrator. 5. Execute: c:xamppmysqlbinmysql.exec:xamppmysqlbinmysql.exe 6. Execute query: UPDATE mysql.user SET Grant_priv=’Y’, Super_priv=’Y’ WHERE USER=’root’;UPDATE mysql.user SET Grant_priv=’Y’, Super_priv=’Y’ WHERE User=’root’; FLUSH PRIVILEGES;FLUSH PRIVILEGES; 7. Close cmd windows. 8. Kill …

Databases, Microsoft SQL Server

Retrieve useful information from SQL Server

Today we will see how can we retrieve various information from Microsoft SQL Server using SQL queries. Get all users: SELECT * FROM sys.server_principals;SELECT * fROM sys.server_principals; Get database size: USE master GO   EXEC sp_spaceuseduse master go exec sp_spaceused Get user privilleges for current database: USE master GO   SELECT SYSOBJECTS.name AS ‘objectname’, SYSUSERS.name …

Databases, MySQL

Retrieve useful information from MySQL

Today we will see how can we retrieve various information from mysql server using SQL queries. Get all users: SELECT * FROM mysql.user;select * from mysql.user; Get top 10 tables in size: SELECT concat(table_schema,’.’,TABLE_NAME) TABLE_NAME, concat(round(data_length/(1024*1024),2),’M’) data_length FROM information_schema.TABLES ORDER BY data_length DESC LIMIT 10;SELECT concat(table_schema,’.’,table_name) table_name, concat(round(data_length/(1024*1024),2),’M’) data_length FROM information_schema.TABLES ORDER BY data_length DESC …