Find the answer to your Linux question:
Results 1 to 8 of 8
The MySQL database I'm having trouble with is hooked into an Apache site, which works fine, except for the part that accesses the database. I'm having trouble getting MySQL to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! acracker's Avatar
    Join Date
    Jul 2007
    Posts
    4

    MySQL service startup error


    The MySQL database I'm having trouble with is hooked into an Apache site, which works fine, except for the part that accesses the database. I'm having trouble getting MySQL to run correctly. I put the file mysqld in /etc/init.d/ so that it would start automatically when the computer is turned on but I'm not sure if it actually does or not. When I log in as root, I type

    "service mysqld start"

    and I get

    "Warning: Asked for 196608 thread stack, but got 126976 Fatal Error: Please read 'Security' section of the manual to find out how to run mysqld as root
    Aborting
    /etc/init.d/mysqld: Shutdown Complete"

    Meanwhile, when I try connecting to the database through the site I get:

    Content-type: text/html
    Software Error:
    can't connect to MySQL database: Can't connect to local MySql server through socket '/var/lib/mysql/mysql.sock' (2)

    Now, the really weird part is if I go back to the bash prompt and type in

    "service mysqld start --user=mysql &"

    I get

    [1] 1677
    Warning: Asked for 196608 thread stack, but got 126976
    InnoDB: Started
    /etc/init.d/mysqld: ready for connections.
    Version: 4.0.21-Standard socket: '/var/lib/mysql/mysql.sock' port: 3306 official MySQL-standard binary

    and then the console freezes and I have to Ctrl+C out of it, but the database connection is now working.
    Is there a way to get this working when the computer starts, so I don't have to type in "service mysqld start --user=mysql &" every time?

  2. #2
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    The init script you added is wrong. Edit it to run as the correct user. Also make sure you're using an init script written for the type of init system you have.

  3. #3
    Just Joined! acracker's Avatar
    Join Date
    Jul 2007
    Posts
    4

    can't edit it

    Opening mysqld in vi gives me a bunch of random characters, I think it is a binary. Are you talking about a different script? I tried creating a separate script called startsql that went like this:

    #!/bin/bash
    service mysqld start --user=mysqld &

    and then I put it in /etc/init.d/
    however, when I restarted the computer, it never ran. Also, it didn't turn green like the other scripts that are in that folder. What is this init script you are talking about? Thanks for the speedy reply.

  4. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    You've done something horribly wrong if anything under /etc/init.d is a binary. What distribution are you using? What steps did you take to install mysql?

  5. #5
    Just Joined! acracker's Avatar
    Join Date
    Jul 2007
    Posts
    4
    I'm using Red Hat Enterprise 4 and someone else installed MySQL long before I ever got the chance to work on it. I moved the mysqld file into /etc/init.d/ but before that, typing "service mysqld start" would give me an error about not finding that service. After I moved it into the /etc/init.d/ folder, I was at least able to get the server running with the "service mysqld start --user=mysql &" command. Is it possible that maybe there should be a different file in /etc/init.d/ that links to mysqld and runs it as the user mysql? Thanks for your help so far.

  6. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    mysqld, the actual mysql daemon, should be in like /usr/bin. Under /etc/init.d there should be a script that controls starting stopping and restarting mysqld. When you got "Service not found" you should have tried running

    Code:
    chkconfig add mysqld
    If that doesn't add the script to init.d, you might wanna consider re installing mysql.

  7. #7
    Just Joined! acracker's Avatar
    Join Date
    Jul 2007
    Posts
    4
    Ok, I tried moving mysqld to /usr/bin/ and then running:

    chkconfig --add mysqld

    but that gave me the error:

    Error reading information on service mysqld: No such file or directory

    So, like you said, I should probably re-install it. Will re-installing mysql affect my databases, or will those be safe? Also, by what method would you recommend re-installing mysql? My yum updater seems to be broken so I might have to compile from source, or find a way to fix yum. Thank you for sharing your knowledge on mysql with me.

  8. #8
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Backup your databases with mysqldump. It sounds like you've got more than one problem, you pretty mcuh never want to install things from source in RHEL. It defeats the whole purpose of RPM. You're looking at re installing methinks.

Posting Permissions

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