Find the answer to your Linux question:
Results 1 to 5 of 5
I am a beginner and i have complete installation of slackware 11.0.i have mysql 5.0 as specified in the /var/log/packages as i could percieve . when i enter the shell ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    3

    How to use MySQL in slackware


    I am a beginner and i have complete installation of slackware 11.0.i have mysql 5.0 as specified in the /var/log/packages as i could percieve .
    when i enter the shell and type $ mysql
    the error i am getting is
    Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
    . please give full commands as i am complete noob

  2. #2
    Just Joined!
    Join Date
    Jan 2008
    Posts
    3
    i got this in one of the post but could not understand it The socket file needs to be created by the database server so when other applications open it, such as the mysql client, they end up talking to the server. You can try and run the mysql database as root (not a terribly good idea most of the time, but might demonstrate the fix). The best way to fix this is to create a mysql user to run the database server as and allow that user access to the /var/run/mysql directory.

    If that doesn't work look for the "socket" line in my.cnf, the mysql configuration file. Update it to point to a location you can write to.

  3. #3
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,110
    I see it's been a few days since your post so you may have a solution by now. If not try this. Open a konsole(terminal), login as root and type: mysql_install_db.
    Again, as root type: chown -R mysql.mysql /var/lib/mysql.
    Also, as root type: /usr/bin/mysqld_safe --user=mysql &
    Open a 2nd terminal and log in as root and type: ps -e | grep my
    You should see some results if mysql is running.
    At the root prompt type: mysql -u root and if you get the mysql prompt(mysql>) you are good.
    You need to set a root passwd, so at the prompt (not mysql>) but root type:mysql -u root mysql and you should get the mysql> prompt. If so, type:
    SET PASSWORD FOR root@localhost-PASSWORD('password');
    If this is successful, you will be able to log in to mysql from the konsole by typing: mysql -u root -p. You can do this same procedure to create users so you are not using mysql as root. to do this, as root log in to mysql and type:
    GRANT ALL PRIVILEGES ON *.* to name@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;
    There are options to set, you do not have to GRANT ALL but check the documentation.

  4. #4
    Just Joined!
    Join Date
    Jan 2008
    Posts
    1
    I agree with yancek but you can easy do with:
    $su root
    #su mysql
    and like mysql user type:
    $mysql_install_db
    etc...

    I do not prefer to set a pass for mysql user account, but you can set access for user in /etc/sudoers (as root) for user or group,
    for group power:
    %power ALL=NOPASSWD:/bin/su mysql
    and then like common user type:
    $su mysql
    and you will become mysql user.

    p.s do not run mysql as root cos you making a files root.root perm. and only as a root you can edit them or use them. And using root account whitout reason is just bad administration.

  5. #5
    Linux Newbie grishi_111's Avatar
    Join Date
    Oct 2007
    Location
    Jafarpur Sitharra(U.P.)/New Delhi, India
    Posts
    188
    i think it should work......
    Try this as root in a terminal
    slapt-get --update && slapt-get --searcn cruxports4slack
    if it finds the package then do
    slapt-get --install cruxports4slack

    as root in a terminal you need to do this
    ports -u
    That will take a while to complete. ... but when it finally does, execute this
    ports -l | grep mysql
    You will see this

    opt/mysql
    opt/mysql-python
    opt/mysql-ruby

    So you do this
    cd /usr/ports/opt/mysql
    Then to begin the build and install ... execute this command
    pkgmk -d -i


    mysql_install_db

    start service
    /etc/rc.d/mysqld start
    After you start the service, you need to log into the mysql server. After you do that, then your shell will look like that

    mysql -h localhost -uroot
    Sorry, Linux is not my passion .
    Its addiction!!!

Posting Permissions

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