mysql problem

James Gray james at gray.net.au
Sun Apr 27 00:06:36 UTC 2008


On 27/04/2008, at 12:40 AM, Carl Friis-Hansen wrote:

> Hi Karl,
> there are some concept issues here
> Karl Larsen wrote:
>> Carl Friis-Hansen wrote:
>>> Karl Larsen wrote:
>>>
>>>>>> karl at karl-desktop:~$ mysqladmin -p secret version
>>>>>>
>>> Hi, Karl
>>> normally you would *never* use sudo for this.
>>> Instead tell the cilient what user you want to log in as.
>>> In you case:
>>> mysql -hlocalhost -uroot -p
>>>
>>>
>>    Hi Carl, my problem was I thought like you are and I put too much
>> information in the command line. As I understand now, MySQL reads the
>> user name from the terminal and then asked for the password. So I  
>> need
>> to be a root user to use that password. I also have another user  
>> set up
>> from my normal user "karl" and that works too. You need to let the
>> system know who is calling on localhost. I have no idea how they  
>> get it
>> working on Windows :-)
>>
> I have supported database systems for a very large software company  
> for
> five years and not one single time needed to be root in order to  
> contact
> a database..

Great! So have I :)  Most of my production databases are well in  
excess of several hundred gigabytes with multiple layers of  
replication.  Admittdly, we're not using Ubuntu in production (we use  
RHEL and CentOS) but the process I've described DOES work the way I've  
outlined it previously.  FWIW, on password-less root (after initial  
installation) if you try "mysql -u root" as a regular user, you'll be  
told that "user at localhost" can't log in (no password remember so the '- 
p' option is useless).  Try the same command with sudo, or after  
switching to a real root shell, and guess what? You get a mysql root  
session.

After a mysql root password is set, this method wont work.  As the OP  
didn't secify whether or not they had set a root password for MySQL  
during the installation, and it's a fairly easy mistake to make, I  
offered a solution that would (as I stated in the follow-up) kill two  
birds with one stone.  The alternative to providing a root mysql shell  
when there's no root password is to reload the mysql daemon bypassing  
the grant tables - making it possible for anyone to log in as a root  
user! Surely you're not suggesting this is a "better" approach to the  
one I've outlined?

Have a read through the source code some time :)

Cheers,

James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080427/ca09db55/attachment-0001.bin>


More information about the ubuntu-users mailing list