wood burning stoves 2.0*
The moose likes JDBC and the fly likes mySQL connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "mySQL connections" Watch "mySQL connections" New topic
Author

mySQL connections

tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
I wasn't really sure where to put this, but i will stick with here for now.
I have installed mySQL onto my mac and i want to create some java programs which will connect to it, i have yet to create the database so when i try and connect i get an error message saying Unknown database 'databaseName'.
Could anyone tell me how to access mySQL to create this new database via the terminal? I have searched and nothing so far seems very clear. Alternatively is there any programs that would help manage the databases? i have used phpMyAdmin online but not locally. I assume all i need to do for this small problem is access via terminal and create the database though?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18498
    
  40


One option is to use the command line tool to connect to MySQL -- which for MySQL, I think it is simply "mysql". From there you can just do a "create database" command to create the database, followed by "create tables", unless of course, you want your application to do that.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2158
    
  47
Not sure about mac's but for windows MySql comes with a command line program called MySQL.exe which allows you to execute SQL statements.
If you want a GUI based tool try MySQL Workbench which I believe is available for the Mac.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
You will find the JDBC tutorial here, and there are lots of SQL tutorials on the web. That will probably get you started off. There is also a MySQL handbook which you can download.

This thread would fit better in our databases fora, as somebody told me, so I shall move it.
tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
Thanks guys, MySQL workbench was the program i was thinking of, i just couldn't remember the name after using it a while ago.
Connection is established and database is created.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mySQL connections
 
Similar Threads
jdbc and the internet
SQLState: 28000
Using PHP with MySql
mysql embedded ... terminal access ?
How to create DataSource to connect to MySQL DB from tcServer