Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 28, 2013, 03:09 PM   #1
snoopy531
macrumors newbie
 
Join Date: Sep 2011
programming with mySQL on mac

Hi,

I would please like to know how can I start coding with mySQL. I have the mac osx 10.6.8 and mySQL Workbench. I downloaded -MySQL Database 5.6.12 DMG and started mysql Server from preference. After the download, I entered in the terminal %mysql --console (command) and after, I got a message: no such job. After that, I entered %mysql -u root and I got also the same message. Usually from a book, I should be able to start coding and I would see mysql> after entering on of those 2 commands in the terminal. I spend hours trying to figure out why that doesn't work and I am still at the same place.

Thank you for your help.
snoopy531 is offline   0 Reply With Quote
Old Jul 28, 2013, 05:34 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Try those commands in Terminal without the percent character eg

Code:
mysql --console (command)
mysql -u root
Robvas already answered this in your other thread how to download and use my sql on mac os x 10.6.8?
__________________
Space Corps Directive 34124

Last edited by kryten2; Jul 28, 2013 at 06:24 PM.
kryten2 is offline   0 Reply With Quote
Old Jul 28, 2013, 09:34 PM   #3
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
You aren't typing the % symbol are you? Only type what comes after that symbol.
robvas is offline   0 Reply With Quote
Old Jul 29, 2013, 06:25 AM   #4
sam051
macrumors newbie
 
Join Date: Jul 2013
Location: Noida
Send a message via Skype™ to sam051
Programming with mySQL is really best plan for programming development. I think if you use PHP then this is the biggest plan. Magento CMS is the best for dynamic website and you can get templates via conversion of simple layout.
sam051 is offline   0 Reply With Quote
Old Jul 29, 2013, 07:55 AM   #5
Game64
macrumors member
 
Join Date: Jan 2011
Location: East Bay, California
Usually I'll code my work in PHP and use Sequel Pro to go ahead and handle all the Mysql Management.

Not sure what language you're looking to code it, or are you looking to code actual SQL Procedures?

http://www.sequelpro.com/

http://www.tizag.com/mysqlTutorial/
__________________
Technical Architect @ C.T. Architecture
Game64 is offline   0 Reply With Quote
Old Jul 29, 2013, 10:34 AM   #6
snoopy531
Thread Starter
macrumors newbie
 
Join Date: Sep 2011
Hi again,

I also tried without the % and I get (command not found) message. I would like to add rows in the database by using the terminal without using PHP.

Thank you
snoopy531 is offline   0 Reply With Quote
Old Jul 29, 2013, 12:27 PM   #7
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
The command:

whereis mysql

Will tell you where mysql is installed. You can start it by using the full path to the command.

http://dev.mysql.com/doc/refman/5.5/...ion-notes.html

You might want to add aliases to your shell's resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

Even better, add /usr/local/mysql/bin to your PATH environment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Section 4.2.1, “Invoking MySQL Programs”.
robvas is offline   0 Reply With Quote
Old Jul 29, 2013, 08:38 PM   #8
peoplevoice
macrumors member
 
Join Date: Aug 2008
Verify if mysql is really running. Check in "Activity Monitor" and search for "mysql".
peoplevoice is offline   0 Reply With Quote
Old Aug 1, 2013, 01:28 PM   #9
snoopy531
Thread Starter
macrumors newbie
 
Join Date: Sep 2011
Hi again,

Thanks to you,
-I found mysql using in the /usr/local/mysql/bin folder and I tried some commands from the mysql terminal. For exemple;
mysql> SELECT VERSION(), CURRENT_DATE();
mysql> SHOW DATABASE;
and I get the right answers , but when I enter the following one, I get a mistake;
mysql> CREATE DATABASE produce;
the mistake is:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'produce'
Can you please tell me why this is wrong? Is it because I don't use a username and a password. I still have problems making that.

-When I enter the following command, nothing special happens:
mysql -u root
and I don't get this message like I should: Welcome to the MySQL monitor. Commands end with; or g

and SELECT_VERSION(), CURRENT_DATE; won't work anymore after that command. I get the following mistake;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root

-also when I enter:
mysql> whereis mysql
why do I get this symbol and not the location?:
->


Thank you very much.

Last edited by snoopy531; Aug 1, 2013 at 01:41 PM.
snoopy531 is offline   0 Reply With Quote
Old Aug 1, 2013, 01:56 PM   #10
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
Quote:
Originally Posted by snoopy531 View Post
when I enter the following one, I get a mistake;
mysql> CREATE DATABASE produce;
the mistake is:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'produce'
Can you please tell me why this is wrong? Is it because I don't use a username and a password. I still have problems making that.
Read up on MySQL users and permissions. This page shows how to create a user and give it access

http://dev.mysql.com/doc/refman/5.1/...ing-users.html

Quote:
-also when I enter:
mysql> whereis mysql
why do I get this symbol and not the location?:
->
You're entering a Linux command (whereis) and not a MySQL command. You need to exit MySQL (just type 'exit') and go back to the Linux command prompt to use that command.
robvas is offline   0 Reply With Quote
Old Aug 1, 2013, 05:12 PM   #11
snoopy531
Thread Starter
macrumors newbie
 
Join Date: Sep 2011
I don't have or use linux and I installed mysql only for Mac os x. From the MySQL users and permissions page, I can't use shell> mysql --user=root mysql . Is that specifically a Linux command? Can we use mySQL on Mac if we don't have Linux? On Mac os x, I can't find nowhere a terminal which begins with shell>. I tried to enter mysql --user=root mysql from the /usr/local/mysql/bin mysql and I only get -> symbol without any other message.

I also tried mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
and I had this error :
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql --user=root mysql
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass' at line 1

I need help on this please.
Thank you very much.

Last edited by snoopy531; Aug 1, 2013 at 05:17 PM.
snoopy531 is offline   0 Reply With Quote
Old Aug 1, 2013, 05:54 PM   #12
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
Quote:
Originally Posted by snoopy531 View Post
I don't have or use linux and I installed mysql only for Mac os x. From the MySQL users and permissions page, I can't use shell> mysql --user=root mysql . Is that specifically a Linux command? Can we use mySQL on Mac if we don't have Linux? On Mac os x, I can't find nowhere a terminal which begins with shell>. I tried to enter mysql --user=root mysql from the /usr/local/mysql/bin mysql and I only get -> symbol without any other message.

I also tried mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
and I had this error :
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql --user=root mysql
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass' at line 1

I need help on this please.
Thank you very much.
When I said 'linux command' I meant unix command, which is fine for OS X - you're just entering the wrong command at the wrong place.

The mysql prompt looks like this:

>

The reason you got the > prompt after typing in 'mysql --user=root mysql' is that it's expecting you to enter a MySQL command. You can just enter a semicolon ; by itself and it will end that command and you can enter a new one.
robvas is offline   0 Reply With Quote
Old Aug 5, 2013, 12:28 PM   #13
Peterk12
macrumors newbie
 
Join Date: Nov 2011
If you want a GUI approach (which you probably don't, as the nature of your question involves the terminal), you can try using Mamp + Coda 2.
Peterk12 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mac programming should be more like iOS programming. moonman239 Mac Programming 13 Feb 17, 2014 01:37 PM
c programming for mac Sriteja25 Mac Programming 3 Jul 5, 2013 03:00 AM
Starting up MySQL on mac on boot estorstenson OS X 7 Jun 7, 2013 02:38 PM
Programming on a Mac ThunderBow Mac Programming 5 Mar 13, 2013 03:25 AM
mac programming SlrP Mac Programming 6 Jan 26, 2013 12:59 PM

Forum Jump

All times are GMT -5. The time now is 03:52 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC