Solved

mysql doesnt ask for username and password

Posted on 2014-01-24
6
337 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 82

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 82

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

21 Experts available now in Live!

Get 1:1 Help Now