SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey folks...I am working with two sets of mySQL DB's. One local, one remote. How do I go about adding a user in the local version to reflect the remote?

    Say username is andy, password is andy, and the access should be the same as root.

    The reason why is because I want the same connect variables in both versions of my site.

    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First look at the records in the user table of the mysql db then insert a new record into that table with the same permissions as root had when you looked at it. Then type

    mysql> FLUSH PRIVILEGES
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Allentown PA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Run these 2 queries:
    GRANT ALL ON *.* TO andy@localhost IDENTIFIED BY 'andy';
    FLUSH PRIVILEGES;

    Note that you might want to change "localhost" and you can use wild cards like those for a LIKE operator. You could even leave off the "@localhost" and it will be assumed to allow access from anywhere (andy@%)

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no such luck with either method.

    This is the error that I get:

    Warning: MySQL Connection Failed: Access denied for user: 'plusone@localhost' (Using password: YES) in ../fragments/main_header.php on line 170

    Unable to connect to the database server at this time.

    what now? It is no big deal, as I can just change the passwords in the include, but it would be much easier if I could simply use the same user/pass for both remote and local for this client.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it looks like you wanted to use the user name andy but in your code you have plusone Are you sure there is a record in the user table for plusone?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry...that is the actual user I want to add. I went through and gave it full access like you said, Yes to everything, then I flushed the privileges and still no access. I even tried leaving out the "localhost" part and still nothing.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does the Host field have for that user it should have 'localhost'
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right now it has % (using phpMyAdmin)

    It HAD locahost. That was what I put in first. It was stil giving me the error so I tried leaving that off. It still gives me that error.

    8(
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so back to your original problem of having two dbs using the same connect statement I will assume that you have one page which gets included in all your pages needing db access, so instead of wasting anymore time trying to get the username password deal to work why not just change the values in that one file or better yet make two copies of the file keep one on the rmeote server with the correct info and keep one on the lcoal side with root's settings and neevr touch them then your app should work wherever it is.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  10. #10
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I could do that but this is the way I have my setup.

    I have a page (ill just use one for example) called welcome.php3. It contains my content. It includes a file called main_header.php. main_header is the file that contains my variables. It also contains navigation menus for the site which may change over time. SO, It would be safer for me to have the same user/pass that way I don't forget one of these times and upload a changed version with local user/pass and my site goes down.

    You see? For the time being I will just do it the way you suggested, as I don't change the menu more than once a every month or two.

    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or to save yourself a lot of time in the future just take the db connect vars out of main_header and put them into a file called let's say connect.php then add the include("connect.php"); to every page of the site above the include("main_header.php"); line. That way you are keeping the menu stuff separate from the db stuff.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe

    I was trying to avoid doing that. I spent about two hours getting rid of extra stuff from those pages to begin with.

    But I suppose that is the best way to do it.

    thanks for confirming
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  13. #13
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you use an html editor to do your coding most of them have search and replace so just search and replace

    include("header.php");

    with

    include("connect.php");
    include("header.php");
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •