MySQL installation is screwy...

Discussion in 'Web Design and Development' started by noahgolm, Nov 27, 2010.

  1. noahgolm macrumors member

    Joined:
    Aug 18, 2010
    #1
    Hi, all. Recently, I have been trying to create a little home server website via my macbook. It has gone fairly well, and I even implemented PHP and JavaScript (I'm so proud as a beginner...)! Anyways, as a way to learn more about the security of websites, I installed MySQL onto my computer. Unfortunately, it does not work at all! I always get the error message:
    "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"
    I checked the /var/lib/ folder, and found that /mysql/mysql.sock or even just /mysql was there! What could be the problem here?
     
  2. Winni macrumors 68030

    Winni

    Joined:
    Oct 15, 2008
    Location:
    Germany.
    #2
    You usually get that error message when the MySQL server is NOT running. When you use one of the Mac OS X packages from mysql.com, it installs the server, but does not automatically launch it once the installation is finished. The easiest way to get it going is to also install the control applet for System Preferences by double clicking on it, then open System Preferences and open the MySQL panel and launch the server. You should also install the startup item, which is also part of the MySQL package.

    Enjoy! :)
     
  3. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #3
    Well, I checked, and the server is on. The problem still persists, though! And, through system preferences, I tried to stop and start it again. It stops just fine, but clicking the start button does nothing!

    On another note, I just picked up a copy of a book detailing how to build databases with PHP and MySQL. It suggested installing MySQL via the MAMP package. Would this maybe work better than my currently failed install via the .dmg download?
     
  4. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #4
    Check /tmp when the server is running.

    See if mysql.sock is there.
     
  5. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #5
    For some reason, the server doesn't turn on when I click the preference pane button, or go through terminal!
     
  6. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #6
    OK, I deleted everything (with the instructions from several websites) from MySQL, and tried reinstalling it. And now, I found out, I can't start the server in the first place! I ran "sudo /usr/local/mysql/bin/mysqld_safe" and the error reads this:

    Code:
    mysqld_safe mysqld from pid file /var/run/mysql.pid ended
    
    Anyone have any ideas to fix this?
     
  7. jerry333 macrumors member

    jerry333

    Joined:
    Nov 4, 2005
    #7
    You'll need to look at the mysql logs to see what the actual errors are.
     
  8. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #8
    Here's the error log for one session:

    Code:
    101127 18:06:42 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
    101127 18:06:42 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
    101127 18:06:42 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
    101127 18:06:42 [Note] Plugin 'FEDERATED' is disabled.
    101127 18:06:42  InnoDB: Started; log sequence number 0 44233
    101127 18:06:42 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysql.pid' (Errcode: 13)
    101127 18:06:42 [ERROR] Can't start server: can't create PID file: Permission denied
    101127 18:06:42 mysqld_safe mysqld from pid file /var/run/mysql.pid ended
    
    I don't know why the error "Permission denied" is there. I ran the command with sudo...
     
  9. wpotere Guest

    Joined:
    Oct 7, 2010
    #9
    Folder permissions are not right. What are they currently set at?
     
  10. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #10
    To be quite honest, I don't know. MySQL is laid out in a bunch of different places, usually /usr and /var. How do check/change the file permissions?
     
  11. wpotere Guest

    Joined:
    Oct 7, 2010
    #11
    It shouldn't be... It should all be located in one folder if you used the installer (unless it has changed).

    ls -al will give you a listing of the folders with their permissions and chmod will let you change it. If you are the only one that uses that machine and it is behind a firewall you could chmod the parent folder and other files to 775.

    Did you follow this installation?

    http://hivelogic.com/articles/compiling-mysql-on-snow-leopard
     
  12. noahgolm thread starter macrumors member

    Joined:
    Aug 18, 2010
    #12
    Tried chmod 775 to give access, and now I'm getting some different errors, which I don't get. When I just run "mysql" the output is the same, but the error log shows this:

    101128 23:32:14 mysqld_safe A mysqld process already exists


    And when I then run "mysqld" there is no error log, but the output shows this:

    101128 23:38:49 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
    101128 23:38:49 [Warning] Can't create test file /usr/local/mysql-5.1.53-osx10.6-x86_64/data/localhost.lower-test
    101128 23:38:49 [Warning] Can't create test file /usr/local/mysql-5.1.53-osx10.6-x86_64/data/localhost.lower-test
    mysqld: Can't change dir to '/usr/local/mysql-5.1.53-osx10.6-x86_64/data/' (Errcode: 13)
    101128 23:38:49 [ERROR] Aborting

    101128 23:38:49 [Note] mysqld: Shutdown complete


    I'm guessing the first warning is just due to the use of --skip-locking as a nearly outdated command, but could the rest be permission issues still, or something else?
     
  13. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
  14. harpster macrumors regular

    Joined:
    Jan 26, 2010
    #14
    Just use MAMP, it's easy and doesn't mess up your system. You will have a complete web server (apache, php, mysql, phpmyadmin) installed in no time flat. Everything will be located in one folder on your Mac (Applications/MAMP). Then put your server files (your code) in Applications/MAMP/htdocs.

    Let's say you have a php file in htdocs named mycode.php. You would then load that in a browser with http://localhost:8888/mycode.php. If you change the default MAMP port of 8888 to 80 then you can just use http://localhost/mycode.php It's that simple!
     
  15. jerry333 macrumors member

    jerry333

    Joined:
    Nov 4, 2005
    #15
    This means there is either a mysqld process running (use ps -ef |grep mysql to see)
    Or there is a PID file that hasn't been removed.



    That's mostly a nothing warning.


    These mean that either the directory doesn't exist, isn't owned by the mysql user, or has the wrong permissions, or a combination of them.
     
  16. wpotere Guest

    Joined:
    Oct 7, 2010
    #16
    What CHMOD command did you use? Did you just change the permission on the folder (chmod 775 mysql)? If so, you probably need to apply the permissions to the contents as well....

    chmod -R 775 mysql
     

Share This Page