mysql problem

James Gray james at gray.net.au
Sat Apr 26 09:09:33 UTC 2008


On 26/04/2008, at 6:56 PM, 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

Yup - the reason I suggested using sudo was because in my experience  
if there hasn't been a mysql "root" password set then you must be UID/ 
EUID zero in order to connect as "root' on mysql.  So to kill 2 birds  
with one stone, running "sudo mysql" does two things:
1. Tells mysql that you're attempting to connect as "root at localhost"
2. Sets your UID/EUID to zero.

If the OP hadn't set a mysql "root" password this method will get you  
a root shell in mysql.  If they HAVE set a root password, the mysql  
client will prompt for one.  In the latter case, you DON'T need to be  
UID/EUID zero in order to login.  Any user with the MySQL root user's  
password can login by specifying "-u root" when running "mysql" on the  
command line (provided the host they are connecting from has  
permission to connect as "root").

Just thought that seeing as we're in the act of being precise, I'd  
clarify the logic behind my instructions ;)  But you are most  
definitely correct....as long as the user set the mysql "root"  
password during installation.  If they didn't, the "sudo mysql" method  
usually works.  Failing that, you need to bypass the grant tables on  
start and set one manually (there's HEAPS of resources/how-to's/walk- 
throughs on how to accomplish this on the 'net).

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/20080426/38c4373e/attachment.bin>


More information about the ubuntu-users mailing list