Help get this topic noticed by sharing it on Twitter, Facebook, or email.

PHP & MySQL Missing Manual: MySQL username / password

PHP & MySQL Missing Manual 2nd Edition; Ch. 4: MySQL and SQL; pg. 98.

I am on a 2016 Macbook Pro w/ OS X EL Capitan. None of the instructions from page 98 of this book seem to work for me. I followed the steps for editing my .bash_profile but didn't complete this step as I did not understand where to input "PATH=$PATH:~/bin" or how to save it once I typed it in. If I am understanding correctly, this step just allows me to input "$ mysql" instead of the full path every time in the terminal to access the server?

All I am really trying to do is set up mysql (username and password) like the book is instructing me to do on page 99 so I can move on. What am I doing wrong? I have to be missing something. When I open /Applications/MAMP/Library/bin/mysql, the terminal responds with the following (where you see the "->" I have tried inputting "-u root -p" "-uroot -p" and every variation I could possibly conceive but I never get a prompt for a password):

/*

Last login: Thu Aug 25 13:12:23 on ttys000
Joshuas-MacBook-Pro:~ jpinkman$ /Applications/MAMP/Library/bin/mysql ; exit;
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.42 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> $ /Applications/MAMP/Library/bin/mysql -uroot -p
-> -uroot -p
-> -u root -p

*/

I am so frustrated! I really don't know hardly anything about MySQL but I thought this book would explain a little more than it has. It's not like you can just skip mysql setup and then move on to something else. It also probably doesn't help that I am trying to learn this completely on my own from just this book and the internet. This forum is my last resort before I close the text up and move on to something else. I really hate to let one simple little thing defeat me but I have been trying to get this username / password to work for like 2 days now. I would bet what I am doing wrong is so obvious to someone who knows anything about this.

Any help is greatly appreciated!
-Josh
1 person has
this problem
+1
Reply
  • Hi Josh,
    Thanks for reaching out to us about our Missing Manuals! I've very sorry to hear of your frustration with this book. I've forwarded your question to the author and editor to get some definitive answers for you, and I hope to hear back from them soon about your question.
    Aside from the forum here, the best way to get help with our books is to drop us a line to booktech@oreilly.com, and we can assist there as well. I'm not sure if you've found this site, but it was pretty helpful to me when I was learning HTML back in college: http://www.w3schools.com/ . It's got some PHP / MySQL courses there that may be of use to you as well.


    If you have any further questions or require further assistance,You can contact us at:
    1-800-889-8969
    or
    1-707-827-7019 (outside the USA)
    7:30 am to 5:00 PST Monday - Friday
    Or email us at orders@oreilly.com

    Cheers
    Tai H.
    Customer Service Rep,
    O'Reilly Media
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Thanks Tai,

    I sincerely appreciate your reply! I think the main issue is my lack of rudimentary UNIX knowledge. I have since been learning the basics of interacting with terminal. I have still not resolved this specific issue but I feel I am well on my way. I think it would have been helpful if the author mentioned the necessity of being familiar with UNIX in general.

    I have actually been using the w3schools since I hit the "roadblock" in the book -- very informative! Thank you so much for your reply, it means a lot!

    -Josh
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Hi Josh,

    Is the step you still need help with adding the PATH to the .bash_profile?

    I can help with that. The instructions in the book use the vi editor, which I personal dislike, and it's definitely not for the faint of heart. Below are instructions for using an easier text editor (nano) to edit your PATH -

    Here are the instructions from page 98 in the book, using nano and with a little clarification -

    Open the Terminal and create the "bin" directory in your home directory -

    mkdir ~/bin

    and then going into that directory by typing this comand -

    cd ~/bin

    Then create the symbolic link, which is like an alias -

    ln -s /Applications/MAMP/Library/bin/mysql mysql
    (that creates a "mysql" alias in that directory that points to the original)

    Then, edit your .bash_profile by using this command to open it in nano -

    nano ~/.bash_profile

    Here is my current PATH before editing when I type - echo $PATH
    /usr/local/mysql/bin:/usr/local/bin

    add
    export PATH=$PATH:~/bin
    to a new line in the .bash_profile
    then exit and save using the instructions on screen in the editor.
    Quit the terminal and restart it and type echo $PATH to see the changes.

    Now my PATH looks like this when I type - echo $PATH
    /usr/local/mysql/bin:/usr/local/bin:/Users/chriso/bin

    Once that is all done, to start MySQL, you just need to type mysql in the Terminal instead of /Applications/MAMP/Library/bin/mysql

    I hope that helps,
    Chris Olson
    O'Reilly Customer Service
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited