Solved

mysql doesnt ask for username and password

Posted on 2014-01-24
6
344 Views
Last Modified: 2014-02-01
Hello

I have just gained access to a server with a hosting company which has mysql preinstalled. I've only used a server where I have installed mysql myself. On this server i can type mysql at the command line and it will open without needing a username or password. Looking at the mysql. users table there are several users including 2 root users (with different hosts, one is localhost and one is something else). I dont know the root passwords as I didn't create them.

Is it running in safe mode without password protection? If so, how do i tell?

Do i need to change the root password as described here?

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch34_:_Basic_MySQL_Configuration#.UuKwyNLFJCI

i.e change the root password and then restart the service in normal mode?

Sorry for asking, I'm just a bit nervous about doing it

thanks in advance
0
Comment
Question by:andieje
  • 3
  • 2
6 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39807312
I've never heard of that exactly but I have worked with a couple of hosting companies that will automatically log you into your own phpMyAdmin when you are already logged into your account.
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 500 total points
ID: 39807758
Check  also if you have a .my.cnf file in your home directory.  I once encountered a server that had the username and password stored there.  The mysql client looks for that file if you didn't enter complete credentials.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39807768
If this is a completely new installation of MySQL, it might still have anonymous users with no user name or password.  Those should be deleted if they are still there.
http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:andieje
ID: 39808649
the my.cnf file just has the max number of connections set to 500  and log_slow_queries. There is nothing else in the file. As mentioned in the question there are several users in mysql.users table. There are 2 root users - one at localhost and one at something which appears to be the hosting company. There are 10 users in total, all of which appear to have encrypted passwords. I presume this means the anonymous user has gone?

I am not logging in via phpmyadmin. I am ssh into the server and then when i type mysql at the command line it just opens and you can access the databases therein. There are 9 databases including the mysql one, I dont know what these are but I havent made them.

I've never seen this before
0
 

Author Comment

by:andieje
ID: 39808654
Is this because i am logged into ssh as root? i've always been root before and had to give mysql a username and password. If i type mysql -u root -p mysql it will ask me for a password but if i just type mysql it starts the database anyway
0
 

Author Closing Comment

by:andieje
ID: 39826857
that was it
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now