The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 08, 2009, 02:23:45 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: phpmyadmin, adding a user and database  (Read 714 times)
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« on: July 25, 2008, 06:23:07 PM »

Although I use phpmyadmin alot, i am generally not familiar with the privileges because I have only ever used it on a shared host.

so... i cant seem to get something to work.
what i want is a database, with 1 user that has full rights, and can connect to the database from php.

so this is what i have been trying with no joy.

I go into privileges
add a user
  I enter the username
  host i select anyhost
  obviously type a password
  and I select "Create database with same name and grant all privileges"
i submit the form.

now when I try to connect to the database from PHP, or even try to log in via phpmyadmin, i get denied.

so what am i missing?
Logged
deregular
Journeyman
***
Offline Offline

Posts: 67


View Profile
« Reply #1 on: July 25, 2008, 09:59:29 PM »

Without looking,
I think you have to "check all" privileges manually also,
I remember something like that.
Logged
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #2 on: July 25, 2008, 10:49:03 PM »

that would be dumb... ill try that...
Logged
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #3 on: July 25, 2008, 11:00:18 PM »

yea, that didnt work either.
Logged
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #4 on: July 26, 2008, 08:18:45 AM »

ok, i am confused

what is %

under privileges, a user can be set to % or Localhost or other things.
what is the purpose in the "host" field?

I just changed the login to localhost, and it now works, which I guess makes sense, since the user is logging in FROM localhost since its a PHP app?
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 679



View Profile
« Reply #5 on: July 26, 2008, 07:24:33 PM »

Why bother with phpMyAdmin?

"mysql" from a shell works just fine.
Logged

nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #6 on: July 26, 2008, 07:40:09 PM »

regardless, even setting up the user from the shell, the same issue applies. Its not a phpmyadmin issue really, its a wtf does % actually mean issue.

plus, why would i want to make my life more difficult by not using a user friendly tool?

Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 679



View Profile
« Reply #7 on: July 26, 2008, 08:18:47 PM »

plus, why would i want to make my life more difficult by not using a user friendly tool?

Why not just use all the prewritten software that's out there already then, by the same token? Why ever write anything. There are thousands of programmers in the world, surely whatever it is you need at any given moment can be had pre-made.

I do what I do because I like as few layers of abstraction as possible between me and what's really going on, and because I hate using a mouse. If I could just leave my hands on the keyboard the entire time I'm working, that'd be just fine with me. Fortunately, I can.

Aside from when I slack off and post on these damn forums, that is!
Logged

nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #8 on: July 26, 2008, 10:36:44 PM »

lol. nerd
Logged
sassy bear
Rookie
**
Offline Offline

Posts: 21


Sassy Bear


View Profile
« Reply #9 on: July 27, 2008, 04:14:54 AM »

I also, wonder what that % means and I am working on narrowing down why
but i check all privileges to the localhost and % root account and try to
change the root password (or the user with same priveleges i created) and i
get this cant connect on mysql_connect error Using password: YES error.
I will post more when i have some good solid evidence on how to recreate my
problem but right off the bat this isnt making sense to me either, NBs.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #10 on: July 28, 2008, 01:28:34 PM »

The % is a SQL wildcard... for example, you could create a user and grant all for host = 192.168.% and everything on your private network will work. I've personally noticed I have more trouble when I go 192.168% than 192.168.%... this sounds more like a location and privileges problem. phpMyAdmin is on the local box, right? So set up a new user, "nutballs" - grant all on local host and you'll be fine. MySQL is very pessimistic about rights and privileges, so you'll need to make sure that your off-box user is dialed in right or it just wont connect, as you are clearly seeing.

I'l be around later we can play with it as well. I'm pretty familiar with these situations.
Logged

If I can't be Mr. Root then I don't want to play.
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #11 on: July 28, 2008, 01:47:02 PM »

thats what i figured and knew, its a wildcard.
so setting the host to % should be 'allow all hosts' right? but yet no joy.
does % exclude localhost and 127.0.0.1? because thats what it seems like to me.

being that it works when I change the user's host setting to localhost, tells me that % is exclusive of the two locals.

the scenario is a very common one,
create user and database
give user all rights to the database
connect to database from php on the same machine.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #12 on: July 28, 2008, 01:51:11 PM »

Personally I'd never allow % to access a box, because it opens up a hole (obviously, depending on other circumstances). I've not had luck with % either and cannot tell you why. I've only had luck with the 192.168.% sort of notation, although that makes no sense at all
Logged

If I can't be Mr. Root then I don't want to play.
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #13 on: July 28, 2008, 02:05:24 PM »

Meh, whatever. I dont really care, because like you said, that would not be a legitimate setup anyway for a production environment. But I just was trying to quickly get stuff going in dev, and my usually MO is , lockdown later.
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!