I would like to run the program: mysql client

I am on a MacBook, with MAMP installed. I don't really know command line to save my life?!

I found a cool blog that spelled things out, but when I followed the instruction, nothing happens. I went to this path...

/Applications/MAMP/Library/bin/

But when I type

mysql -uroot -p

nothing happens?!

Amy

    um its a mac, don't they have pretty little pictures you click on? They are designed for people who like that sort of thing.

      dagon;10915660 wrote:

      um its a mac, don't they have pretty little pictures you click on? They are designed for people who like that sort of thing.

      No need to be a smart ass. If you can't offer something positive then don't post...

      I was asking for help in Terminal - not in the "pretty little pictures" section.

      Amy

        7 days later
        amy.damnit;10915571 wrote:

        I would like to run the program: mysql client

        But when I type

        mysql -uroot -p

        nothing happens?!

        Amy

        Nothing? Its gotta say something, right, even if its just to complain the command was not recognized.

        The general use: mysql -u <user> -h <host> -p <database> then it will prompt you for password. Typically I only use mysql at the command line to process an sql file ala:

        mysql -u user -h host -p database < some_data_or_table_structures.sql

        Especially useful when you are creating a new database from a backup sql dump that is large, like 7GB.

        Its useful to have aptitude for using the mysql client like when you have to access a remote system that doesn't have phpmyadmin or other way to get a "gui" interface of any kind. And its kinda cool...I have a thing for monochrome displays and blinking cursors that I can't explain.

          Jazz Snob,

          jazz_snob;10916547 wrote:

          Nothing? Its gotta say something, right, even if its just to complain the command was not recognized.

          The general use: mysql -u <user> -h <host> -p <database> then it will prompt you for password. Typically I only use mysql at the command line to process an sql file ala:

          mysql -u user -h host -p database < some_data_or_table_structures.sql

          Well, it did say something, but that was a week or two ago, and I have forgotten what they may have been.

          The problem, apparently, is that I had to type in the full path plus mysql to get it to work, like this...

          /Applications/MAMP/Library/bin/mysql -uroot -p

          Before, I had navigated to...

          /Applications/MAMP/Library/bin/

          then typed...

          mysql -uroot -p

          and it didn't work, which makes no sense, considering these two scenarios seem like "six of one, a half-a-dozen of another" to me?!

          Any way, I did it the second way and had luck.

          Its useful to have aptitude for using the mysql client like when you have to access a remote system that doesn't have phpmyadmin or other way to get a "gui" interface of any kind. And its kinda cool...I have a thing for monochrome displays and blinking cursors that I can't explain.

          Yes, I agree with you, and that is why I was trying to use the command line MysQL client versus phpMyAdmin.

          Maybe I need to buy a "Dummies Guide to Unix" or something??

          Amy

            The mysql client isn't on your path. You can see your path by typing:

            echo $PATH
            

            PATH environment variable. You can add that directory to your path:

            export PATH="$PATH:/Applications/MAMP/Library/bin/" 
            

            and you can either do that after you start terminal, or you can add it to the appropriate "start up" file. I'm not clear on all the technical terms, but on Linux box I have a bash shell and I set environment variables in a file named .bash_profile in my home directory, for example:

            export CVS_RSH=ssh
            export LD_LIBRARY_PATH=/usr/local/lib
            export JAVA_HOME=/usr/local/java
            export MYSQL=/usr/local/mysql
            export PATH=$PATH:$JAVA_HOME/bin:$HOME/bin:$MYSQL/bin
            
            

            On my G4 I believe the default shell is not bash. I don't know but would guess you could change it. Its close enough in behaviour I can't tell.

            By the way, to execute the file in the same directory you have to type:

            ./mysql
            

            which is like saying "ok start looking in the current directory for this executable"

            Some refs:
            http://www.gnu.org/software/bash/manual/bashref.html
            http://www.ibm.com/developerworks/linux/library/l-bash.html
            I don't know where the manual is on mysql.com, I usually download it and install it locally: http://dizzy.phpfunk.com/mysql/manual_toc.html

              jazz_snob;10916600 wrote:

              The mysql client isn't on your path. You can see your path by typing:

              echo $PATH
              

              PATH environment variable. You can add that directory to your path:

              export PATH="$PATH:/Applications/MAMP/Library/bin/" 
              

              When I typed echo $PATH this is what I got...

              user1s-macbook:~ user1$ echo $PATH
              /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
              

              What am I suppsed to do from there?

              And what exactly is it that you are doing with the "path" and the "path environmental variable" 😕

              Amy

                All operating systems have a "path" which is essentially a list of folders to look for executables in. The PATH environment variable contains a semi-colon delimited list of directories. There are some standard ones, and thats the list you see. So if you want to be able to lauch mysql client for any directory you'll need to add it to your path.

                Alternatively you could place a symbolic link in a folder on the default path, like in /usr/local/bin and point it to the location of the mysql file. You could type "man ls" at the terminal for info on symbolic linking. Then you don't have to alter the path. That is probably easier.

                  Write a Reply...