New MySQL user

Problems with the Linux version of XAMPP, questions, comments, and anything related.

New MySQL user

Postby Kagaherk » 15. November 2007 22:05

Hi!

I've recently begun trying out XAMPP and I really like it so far. :) I'm having a problem however with creating a new MySQL user... I don't really like running PHP scripts with root MySQL access.

I've ran XAMPP security, and logging in to mysql command line using root and the root password works just fine. I used:

Code: Select all
/opt/lampp/bin/mysql -u root -p
...

CREATE DATABASE newdatabase;

GRANT ALL PRIVILEGES ON newdatabase.* TO 'newacc'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;


The last query returns 'Query OK, 0 rows affected', however, and logging in using this new user returns an error. I've also tried adding the user using PHPMyAdmin but with the exact same result.

Does anyone have an idea on how to do this correctly? :)

Thanks in advance,
Kagaherk
 
Posts: 3
Joined: 15. November 2007 21:51

Postby Wiedmann » 15. November 2007 23:52

however, and logging in using this new

You mean with:
Code: Select all
/opt/lampp/bin/mysql -u newacc -ppassword

?

returns an error

Which?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Kagaherk » 16. November 2007 00:04

The error returned is:

Code: Select all
ERROR 1045 (28000): Access denied for user 'newacc'@'localhost' (using password: YES)
Kagaherk
 
Posts: 3
Joined: 15. November 2007 21:51

Postby Wiedmann » 16. November 2007 00:27

You have any anonymous user defined in MySQL?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Kagaherk » 16. November 2007 01:04

Mmmm. As I haven't changed anything else in MySQL, I assume so. I have deleted the anonymous user(s) and... miraculously: my new account works! :D

It seems I missed this section of the MySQL manual.

Code: Select all
Without the localhost account, the anonymous-user account for localhost that is created by mysql_install_db would take precedence when monty connects from the local host. As a result, monty would be treated as an anonymous user. The reason for this is that the anonymous-user account has a more specific Host column value than the 'monty'@'%' account and thus comes earlier in the user table sort order.


Thank you very much for the fast responses :)
Kagaherk
 
Posts: 3
Joined: 15. November 2007 21:51


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 17 guests