Solved

mysql doesnt ask for username and password

Posted on 2014-01-24
6
341 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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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 …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

24 Experts available now in Live!

Get 1:1 Help Now