Wednesday, 16 January 2013

MYSQL

1>To See all users in the MySQl
SYN:-->
SELECT * FROM mysql.user; 
 
2>To drop user from mysql
SYN:-->
drop user username;
 
3>To know the column is in which table
SYN:-->
SELECT table_name FROM user_tab_cols WHERE column_name like '%COUNTRYCODE%';
We get the list of table names which contains the column name as COUNTRYCODE
O/P
TABLE_NAME
------------------------------
EMPLOYEE
USER 
 
 
IF error is ERROR 1396 (HY000): Operation CREATE USER failed for 
The Solution is 
drop user admin@localhost; 
flush privileges; 
create user admin@localhost identified by 'admins_password' 
 
To drop user from mysql SYN:--> drop user username;
 
To See all users in the MySQl SYN:--> SELECT * FROM mysql.user;  

2 comments:

Ravi said...

What is difference between TRUNCATE,DROP,DELETE in SQL?

ANS:
DROP-->1.The DROP command removes a table from the
database.
2.It cannot be rollback.

DELETE-->1.The DELETE command is used to remove
rows from a table
2.After performing a DELETE operation
you need to COMMIT or ROLLBACK the
transaction to make the change
permanent or to undo it.

TRUNCATE-->1.TRUNCATE TABLE is functionally
identical to DELETE statement with
no WHERE clause

Ravi said...

To see current user who have logged in

SYN:-->
SELECT USER();

Simplest way to display Server Time in JSP using js

THE BELOW CODE WORKS ONLY IN JSP : <html> <body > <table width="95%" border="1" cellpadding="1...