After transferring site to a new server, my scripts don't work anymore.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shreedhan
    New Member
    • Jul 2007
    • 52

    After transferring site to a new server, my scripts don't work anymore.

    Hi
    I am trying to transport database and php codes from my computer to some other computer.

    I use fedora 6 and I have 'user' account in my pc
    I created a database 'db' as root and granted all permissions to user.
    Then I created tables using that account. And further, I have written code for PHP so as to work with that 'user'.

    So, now I want to transfer whole database and those PHP codes to some other computer.
    The problem is that computer doesn't have any user named 'user'.
    So, how can I now get everything working in that PC as it is in my PC ?

    I tried to add a user named 'user' and created a database 'db' and granted everything to 'user' as root.
    And I created a file using mysqldump in my PC, then restored in another PC.
    It is now showing tables, but the problem is my PHP code isn't working.

    What shall I do to get working?

    Thanks
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Shreedhan.

    Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

    Check your MySQL connection script and make sure you are using the correct Username and password. Note that you don't have to use the same credentials as the previous server; you just have to make sure that what your script says is identical to what MySQL is expecting.

    We'll tackle why it's a bad idea to give your script root privileges later.

    How are your scripts not working? Are you getting any error messages?

    Comment

    • shreedhan
      New Member
      • Jul 2007
      • 52

      #3
      Thanks pbmods for reminding me about the guidelines.

      I think I need to further explain my problem

      In the php code I have something like:
      [PHP]$link=mysql_con nect('localhost ','user','passw ord');[/PHP]

      where 'user' and 'password' are username and password of mysql.

      So, when I transfer to a new server, what shall I do so that all the codes that I have written in PHP which use above statement work properly.
      Do I need to create a user account named 'user' in the new server?
      Or just granting all permissions to non-existing user is enough?

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Shreedhan.

        In MySQL, log in as root and execute the following commands:
        [code=mysql]
        GRANT INSERT, SELECT, DELETE ON `databaseName`. * TO 'user'@'localho st' IDENTIFIED BY 'password';
        FLUSH PRIVILEGES;
        [/code]

        You should be good to go.

        Comment

        Working...