Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can only log in as root - what have I missed? 1

Status
Not open for further replies.

MatthewP

Programmer
Jan 16, 2001
176
GB
For some reason I can only log in as root to MySQL on a redhat system. I went in as root and created a database, added users to the user and db databases, but still cannot connect as any other user other than root in telnet, and also cannot connect through Perl scripts. Have I missed something out?...

1. I connected with mysql -p mysql and entered password
2. create database myDataBase;
OK
3. Show databases;
They came up - all is well.
4. Insert into user (host, user, password) values ('%', 'my_username', password('my_password'));
Query QK. 1 row affected (0.02 sec)
5. Insert into db values ('%', 'myDataBase', 'my_username', 'y','y','y','y','y','y','y','y','y','y');
Query OK, 1 row affecred.
6. flush privileges;
Query OK, 0 rows affected

 
If you want to connect from the same machine that is running the MySQL server, you need to explicitly have a '
Code:
localhost
' entry in your
Code:
Host
columns. The '
Code:
%
' does not match '
Code:
localhost
'. Repeat (or replace) steps 4 and 5 with
Code:
localhost
instead of
Code:
%
.

-Rob
 
Wow thanks. That's sorted it nicely. I was only putting the % in because I was told to - wrongly obviously. What exactly does the % mean then?

Thanks,
Matt.
 
'
Code:
%
' is a wildcard - it stands for anything (with the exception of
Code:
localhost
). You can use it to control access depending on where a user is trying to connect from.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top