-bash: mysql: command not found

Discussion in 'Plesk 6.0 Installation and 'How Do I' Questions' started by corleyman, Dec 11, 2003.

  1. corleyman

    corleyman Guest

    I'm a newbie to shell access. Everywhere I look, people say log into the shell ... then log into the MySQL server by this command:

    mysql -uadmin -p

    But no matter what folder I'm in on the root, "mysql" gives me "command not found"!

    What am I missing?

    Any help would be greatly appreciated.
     
  2. hardweb

    hardweb Guru

    Messages:
    3,558
    Try /usr/bin/mysql.
     
  3. corleyman

    corleyman Guest

    No such path

    My server doesn't have that path. However, the PLESK Server Statistics page has the following path listed:

    /usr/local/psa/mysql/var

    I have tried to run the "sql ..." comman in all this folder as well as all the surrounding folders. I still get the response of:

    -bash: mysql: command not found

    Do I need to put a ' ./ ' before the command, or just continue searching for how to get the "mysql ..." command to work?

    I'm so frustrated that this one little detail is holding me back! Help, please.
     
  4. jtrefet

    jtrefet Mega Poster

    Messages:
    162
    make sure mysql client is installed!
     
  5. corleyman

    corleyman Guest

    MySQL is installed

    MySQL has to be installed. I can add databases using PLESK-30 and then access it using phpMyAdmin to add tables.

    Do you think I should re-install it ... maybe just in the "correct" folder path?
     
  6. jtrefet

    jtrefet Mega Poster

    Messages:
    162
    mysql client and mysql server are 2 different packages.

    do this:

    rpm -qa | grep mysql

    tell me what you see.
     
  7. corleyman

    corleyman Guest

    I entered your command from the root and here is what was returned:


    failed to open /var/lib/rpm/packages.rpm: No such file or directory

    rpmQuery: rpmdbOpen() failed


    So... what do you think that means? Is the MySQL client not installed?

    Thanks so much for any further help you can give.
     
  8. jimroe

    jimroe Guru

    Messages:
    2,067
    Assuming that this post is in the right forum (in other words, that you really have Plesk 6) AND mysql is to be found in /usr/local/psa/mysql/var - then you probably have Plesk 6 installed on FreeBSD - not Red Hat. The mysql client should have been installed by Plesk but it won't be in your default PATH so you have to use the full path to the file. As I don't have a FreeBSD server handy I can't give you the full path to the mysql bianry, but it will be in the /usr/local/psa "tree".
     
  9. corleyman

    corleyman Guest

    Tried some more ... to no avail. Help, Please.

    Yep, we're talking about a system with FreeBSD and Plesk 6.01.

    So if it's not in the default path, are you proposing that I try the command, but with the full path within the command?

    I have tried browsing (using "cd") to the folders that would appear to be correct (like /usr/local/psa/mysql/var or /usr/local/psa/mysql) and then running the same command line, to no avail.

    Then I've tried running the command with the path in the command, like:


    rpm -qa | grep /usr/local/psa/mysql/var/mysql
    or
    rpm -qa | grep /usr/local/psa/mysql/mysql

    But they all return the same exact reponse:

    failed to open /var/lib/rpm/packages.rpm: No such file or directory

    rpmQuery: rpmdbOpen() failed

    Any more good ideas? Or am I doing this all wrong?

    Could somebody either 1) show me how to add the mySQL path the the default path (so the "mySQL" login commands will return a normal response) or 2) show me the exact path that I should be at in order to enter the "mySQL" commands to log into the mySQL server on a FreeBSD server with Plesk 6.01 (30-domain license)?

    I really appreciate any further help you can give!
     
  10. hardweb

    hardweb Guru

    Messages:
    3,558
    The path is
    /usr/local/psa/mysql/bin/mysql
     
  11. corleyman

    corleyman Guest

    More detail ...... PLEASE?

    Could you fill in a little more detail???

    Even after I enter a command like this:

    path=/usr/local/psa/mysql/bin/mysql

    I still get the same message when I try to run a "mysql ..." command! (-bash: mysql: command not found).

    And if I browse to /usr/local/psa/mysql/bin and then try "cd mysql", it says "-bash cd: mysql: Not a directory" ... but if I then type "dir", it shows that "mysql" is in fact a directory there.

    And no matter where the path is set, or where I am browsed to, when I enter this command:

    rpm -qa | grep mysql

    I still get the exact same error:

    failed to open /var/lib/rpm/packages.rpm: No such file or directory

    rpmQuery: rpmdbOpen() failed

    I am really feeling lost here ... any other ideas? Sorry to be such a pest.

    Any further help would be an incredible help!
     
  12. jimroe

    jimroe Guru

    Messages:
    2,067
    The command you want to run to access the mysql client is:

    /usr/local/psa/mysql/bin/mysql

    forget about the "path=" stuff - this is Unix not DOS and it doesn't understand what that means.

    The binary file you want to execute is mysql, and it's in the directory /usr/local/psa/mysql/bin

    FreeBSD doesn't really support RPMs, so the command rpm -qa | grep mysql which will give useful information on a Red Hat system means nothing on a FreeBSD system. On FreeBSD, mysql is installed by Plesk as part of the Plesk Standard install - if you want to see the mysql version you should run:

    /usr/local/psa/mysql/bin/mysql -V and it should report the version.

    You should spend some time on this site:

    http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html

    Since your system is running FreeBSD you should learn about it.
     
  13. corleyman

    corleyman Guest

    YOU ROCK!

    :) That did it! I guess I've been too endoctrinated in the DOS era. Here's the commands that worked:

    root> /usr/local/psa/mysql/bin/mysql --user=admin --password=`password`
    (this logged me into the mySQL terminal)

    mysql> grant usage on * . * to "`username`"@"%" identified by '`password`';
    (this granted access to `username` for all databases on the server from any domain on the internet)

    mysql> grant all privileges on `databasename` . * to "`username`"@"%";
    (this granted full rights to the `databasename` database for user `username` from any domain on the internet)

    mysql> flush privileges;
    (this refreshed the privileges that I just set)

    mysql> exit;
    (this got me out of the mySQL terminal and back to the root>)

    Thank you all for putting up with a true "newbie". I am reading quite in the FreeBSD manual and learning a lot.

    God bless!
    :)
     
  14. jtrefet

    jtrefet Mega Poster

    Messages:
    162
    oops

    glad you got this all worked out!

    I guess I should have found out if you were running redhat before suggesting you go down the RPM path...sorry to lead you astray.
     

Share This Page