Solved

MySQL command to remove anonymous access

Posted on 2012-03-30
5
445 Views
Last Modified: 2012-03-30
Hi

What is the correct MySQL command line syntax to remove anonymous access?

I tried this but it returns an error:

mysql> DELETE FROM mysql.user WHERE user = ;

When I enter this information it gives me error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
0
Comment
Question by:Jason210
5 Comments
 
LVL 6

Assisted Solution

by:torakeshb
torakeshb earned 100 total points
ID: 37786057
0
 
LVL 6

Expert Comment

by:torakeshb
ID: 37786059
mysql> DROP USER ''@'localhost'; and mysql> DROP USER ''@'host_name' if its linux server
0
 
LVL 5

Expert Comment

by:Ronak Patel
ID: 37786061
you need to pass value of "user" which you want to remove from table. and also there wo'nt be a semi-colon at the end of the statement.

try this... (replace "username" with the name of the user you want to delete)
DELETE FROM mysql.user WHERE user = 'username' 

Open in new window

0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 400 total points
ID: 37786072
You might want to first find out if there is one.

SELECT User,Password FROM mysql.user;

Then if you see a blank line or password, you can delete it.

DELETE FROM mysql.user WHERE User = '';

or..

DELETE FROM mysql.user WHERE Password = '';

Remember the table and column names are case-sensitive on Linux.
0
 
LVL 11

Author Closing Comment

by:Jason210
ID: 37786263
Ok, it looks like I missed the two apostrophies. <br /><br />Thanks also for the tip on how to check to see if there is such a user.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question