Solved

MySQL command to remove anonymous access

Posted on 2012-03-30
5
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Assisted Solution

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

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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