New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick MySQL-on-Mac playground? #34

Open
scripting opened this Issue Oct 5, 2017 · 19 comments

Comments

Projects
None yet
8 participants
@scripting
Owner

scripting commented Oct 5, 2017

I want to get back up to speed with SQL, for an application I'm thinking of making.

I tried installing MySQL, but got in trouble because it didn't like the temporary password, and things went downhill from there.

I just want to launch an app on my Mac desktop, and be able to point the Node.js mysql package at it, and start playing.

Or use a remote server, preferably one that's free.

I'm a long way from deploying anything, this is just for play and experimenting. There must be a simple no-brainer answer, so I thought I'd ask the braintrust rather than use trial and error.

Thanks in advance! :-)

@benzado

This comment has been minimized.

Show comment
Hide comment
@benzado

benzado Oct 5, 2017

If you want a Mac GUI for talking to MySQL server, Sequel Pro is terrific and the price is nice (free).

They actually have a how-to page for installing MySQL that mentions an option I hadn't thought of: using Apple's macOS Server app (Never mind, the latest incarnation of Server doesn't include a database.) On my system, I have MySQL installed via MacPorts.

If you just want to play with SQL, you can use SQLite. None of the mess of a separate server! /usr/bin/sqlite3 is already installed on your Mac. (Doesn't Node have a single database library that can talk to either a MySQL host or an SQLite file?)

If you want a hosted MySQL server, you could use Amazon's RDS. It's very much not free, but if you're only experimenting, you'll only have to pay for a few hours of use.

benzado commented Oct 5, 2017

If you want a Mac GUI for talking to MySQL server, Sequel Pro is terrific and the price is nice (free).

They actually have a how-to page for installing MySQL that mentions an option I hadn't thought of: using Apple's macOS Server app (Never mind, the latest incarnation of Server doesn't include a database.) On my system, I have MySQL installed via MacPorts.

If you just want to play with SQL, you can use SQLite. None of the mess of a separate server! /usr/bin/sqlite3 is already installed on your Mac. (Doesn't Node have a single database library that can talk to either a MySQL host or an SQLite file?)

If you want a hosted MySQL server, you could use Amazon's RDS. It's very much not free, but if you're only experimenting, you'll only have to pay for a few hours of use.

@papascott

This comment has been minimized.

Show comment
Hide comment
@papascott

papascott Oct 5, 2017

MAMP https://www.mamp.info/en/ is a quick and easy way to get MySQL (and Apache with PHP) going on a Mac.

papascott commented Oct 5, 2017

MAMP https://www.mamp.info/en/ is a quick and easy way to get MySQL (and Apache with PHP) going on a Mac.

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 5, 2017

Owner

Scott, I have installed MAMP before, a number of years ago, but --

  1. The website has an upsell just like the MySQL site. That makes me suspicious that there's adware baked into the software. Remember the bad old days of Windows viruses. My machines got so infected I had to reinstall the OS every couple of months.

  2. Can I access the MySQL inside the package without wanting the Apache or PHP? What I really want is MySQL without all the other stuffff. ;-)

To the others -- please read the initial message. You are asking questions that are answered there. Let's be respectful, that means reading and trying to understand before opening a reply and typing non-responsive stuff. Thanks. ;-)

Owner

scripting commented Oct 5, 2017

Scott, I have installed MAMP before, a number of years ago, but --

  1. The website has an upsell just like the MySQL site. That makes me suspicious that there's adware baked into the software. Remember the bad old days of Windows viruses. My machines got so infected I had to reinstall the OS every couple of months.

  2. Can I access the MySQL inside the package without wanting the Apache or PHP? What I really want is MySQL without all the other stuffff. ;-)

To the others -- please read the initial message. You are asking questions that are answered there. Let's be respectful, that means reading and trying to understand before opening a reply and typing non-responsive stuff. Thanks. ;-)

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 5, 2017

Owner

Scott, I went ahead and installed MAMP, and stumbled around a bit and eventually figured out how to launch it, and get the MySQL server running. I reconfigured my Node test app to use the parameters I got from MAMP, and it says it worked.

For anyone else following this -- here's the app so far.

var mysql = require ("mysql");
var con = mysql.createConnection ({
	host: "localhost",
	port: 8889,
	user: "root",
	password: "root"
	});
con.connect (function (err) {
	if (err) {
		console.log (err.message);
		}
	else {
		console.log("Connected!");
		}
	});
Owner

scripting commented Oct 5, 2017

Scott, I went ahead and installed MAMP, and stumbled around a bit and eventually figured out how to launch it, and get the MySQL server running. I reconfigured my Node test app to use the parameters I got from MAMP, and it says it worked.

For anyone else following this -- here's the app so far.

var mysql = require ("mysql");
var con = mysql.createConnection ({
	host: "localhost",
	port: 8889,
	user: "root",
	password: "root"
	});
con.connect (function (err) {
	if (err) {
		console.log (err.message);
		}
	else {
		console.log("Connected!");
		}
	});
@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 5, 2017

Owner

Next level report.

I have it creating a database and I think adding a table. But I'm flying mostly totally blind.

There must be some kind of browser for a MySQL database? I bet that's part of MAMP...

http://localhost:8888/MAMP/index.php?page=phpmyadmin&language=English

From there you can walk around through the databases, tables, even enter queries to run against the setup. So you only have to write Node code for ops that are part of apps. Very good.

Owner

scripting commented Oct 5, 2017

Next level report.

I have it creating a database and I think adding a table. But I'm flying mostly totally blind.

There must be some kind of browser for a MySQL database? I bet that's part of MAMP...

http://localhost:8888/MAMP/index.php?page=phpmyadmin&language=English

From there you can walk around through the databases, tables, even enter queries to run against the setup. So you only have to write Node code for ops that are part of apps. Very good.

Repository owner deleted a comment from jsekamane Oct 5, 2017

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 5, 2017

Owner

I got all that I needed working locally to being ready to start developing.

I looked at setting up a hosted MySQL database on Amazon, they ask so many questions that I have no idea how to answer, even when I clicked "Just testing" option (as opposed to provisioning for a mission critical application).

I'll probably just try to install MySQL on one of my Ubuntu servers and see what happens.

Owner

scripting commented Oct 5, 2017

I got all that I needed working locally to being ready to start developing.

I looked at setting up a hosted MySQL database on Amazon, they ask so many questions that I have no idea how to answer, even when I clicked "Just testing" option (as opposed to provisioning for a mission critical application).

I'll probably just try to install MySQL on one of my Ubuntu servers and see what happens.

Repository owner deleted a comment from benzado Oct 5, 2017

@benzado

This comment has been minimized.

Show comment
Hide comment
@benzado

benzado Oct 5, 2017

From your blog:

Also looking for a REPL, some way to issue SQL commands in the Terminal app. That must be possible, right??

I don't know where MAMP installs things, but MySQL ships with a command line tool, mysql, which does just that. If you invoke it without -p it won't prompt you for a password, it will just try to connect and fail. If you save a username and password in ~/.my.cnf you won't have to provide them on the command line every time.

benzado commented Oct 5, 2017

From your blog:

Also looking for a REPL, some way to issue SQL commands in the Terminal app. That must be possible, right??

I don't know where MAMP installs things, but MySQL ships with a command line tool, mysql, which does just that. If you invoke it without -p it won't prompt you for a password, it will just try to connect and fail. If you save a username and password in ~/.my.cnf you won't have to provide them on the command line every time.

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 6, 2017

Owner

A progress report. Spoiler: I'm now running MySQL on a Linux server, along with node and dropbox.

http://scripting.com/2017/10/06.html#a100640

Dave

Owner

scripting commented Oct 6, 2017

A progress report. Spoiler: I'm now running MySQL on a Linux server, along with node and dropbox.

http://scripting.com/2017/10/06.html#a100640

Dave

@jswright61

This comment has been minimized.

Show comment
Hide comment
@jswright61

jswright61 Oct 6, 2017

Not sure where you are with things, and I'm not sure what kind of security you have set up on your DO server. I typically lock down every port but 22, 80, and 443 on my servers. MySQL listens on 3306 by default, but I DO NOT RECOMMEND leaving this port open.

I recommend creating an SSH tunnel from your local machine to your DO server - this will encrypt the traffic and you can use the same security (RSA Key) that you use to SSH to the DO server. You set up the tunnel to connect a local port (3307? or any unused local port) to 3306 on the DO server.

Any command line or gui client on your local server you set to access localhost and whatever local port (3307 from above).

Here's a pretty good explainer on port forwarding: http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

jswright61 commented Oct 6, 2017

Not sure where you are with things, and I'm not sure what kind of security you have set up on your DO server. I typically lock down every port but 22, 80, and 443 on my servers. MySQL listens on 3306 by default, but I DO NOT RECOMMEND leaving this port open.

I recommend creating an SSH tunnel from your local machine to your DO server - this will encrypt the traffic and you can use the same security (RSA Key) that you use to SSH to the DO server. You set up the tunnel to connect a local port (3307? or any unused local port) to 3306 on the DO server.

Any command line or gui client on your local server you set to access localhost and whatever local port (3307 from above).

Here's a pretty good explainer on port forwarding: http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 6, 2017

Owner
Owner

scripting commented Oct 6, 2017

@andrewshell

This comment has been minimized.

Show comment
Hide comment
@andrewshell

andrewshell Oct 6, 2017

I use https://www.sequelpro.com/ on my desktop to connect to remote SQL servers.

Here is a screenshot of how I have it configured to ssh into the server then connect to MySQL on localhost (127.0.0.1)

screen shot 2017-10-06 at 10 46 22 am

andrewshell commented Oct 6, 2017

I use https://www.sequelpro.com/ on my desktop to connect to remote SQL servers.

Here is a screenshot of how I have it configured to ssh into the server then connect to MySQL on localhost (127.0.0.1)

screen shot 2017-10-06 at 10 46 22 am

@jystervinou

This comment has been minimized.

Show comment
Hide comment
@jystervinou

jystervinou Oct 6, 2017

What @andrewshell and @benzado said. I also highly recommand Sequel Pro. You just provide the SSH credentials, and the same MySQL credentials used by your server node app.

You then have a one click access to your database (Sequel Pro remembers the credentials, and handles all the SSH tunnel and shit(*) by itself ;-) )

You can easily:

  • browse your tables/data
  • create/alter the structure and data
  • access easily the MySQL command line (The "Request" icon), see results in a table, save most favorite queries.
  • etc...

(*) sorry i'm French, is it a good word?! ;-P

jystervinou commented Oct 6, 2017

What @andrewshell and @benzado said. I also highly recommand Sequel Pro. You just provide the SSH credentials, and the same MySQL credentials used by your server node app.

You then have a one click access to your database (Sequel Pro remembers the credentials, and handles all the SSH tunnel and shit(*) by itself ;-) )

You can easily:

  • browse your tables/data
  • create/alter the structure and data
  • access easily the MySQL command line (The "Request" icon), see results in a table, save most favorite queries.
  • etc...

(*) sorry i'm French, is it a good word?! ;-P

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 6, 2017

Owner
Owner

scripting commented Oct 6, 2017

@jystervinou

This comment has been minimized.

Show comment
Hide comment
@jystervinou

jystervinou Oct 7, 2017

Sequel Pro is indeed the Cadillac of MySQL front-ends, but with the ease of use of an autonomous car ;-)

jystervinou commented Oct 7, 2017

Sequel Pro is indeed the Cadillac of MySQL front-ends, but with the ease of use of an autonomous car ;-)

@danderson3

This comment has been minimized.

Show comment
Hide comment
@danderson3

danderson3 Oct 15, 2017

In school in 1978 you probably used Ingres and Quel..., early and popular relational tools

danderson3 commented Oct 15, 2017

In school in 1978 you probably used Ingres and Quel..., early and popular relational tools

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 15, 2017

Owner
Owner

scripting commented Oct 15, 2017

@danderson3

This comment has been minimized.

Show comment
Hide comment
@danderson3

danderson3 Oct 15, 2017

The head of databases at Amazon is Mark Porter, a friend of mine. I forwarded your comments on the Aurora experience and he asked his team to address them!

danderson3 commented Oct 15, 2017

The head of databases at Amazon is Mark Porter, a friend of mine. I forwarded your comments on the Aurora experience and he asked his team to address them!

@scripting

This comment has been minimized.

Show comment
Hide comment
@scripting

scripting Oct 16, 2017

Owner

Dan, that's great. Send my best wishes. They could really factor it. Make almost all the choices for you, and give you some starter code to access your database from your choice of language. Just a matter of good defaults.

When I design software, as I did with blogging, I write down the steps carefully, and then offline think about ways to eliminate steps. Iterate over it. That's how I came up with Edit This Page. 3 steps to edit. At the outset was about 20. I think the same thing could be done with an Amazon-hosted SQL database.

Owner

scripting commented Oct 16, 2017

Dan, that's great. Send my best wishes. They could really factor it. Make almost all the choices for you, and give you some starter code to access your database from your choice of language. Just a matter of good defaults.

When I design software, as I did with blogging, I write down the steps carefully, and then offline think about ways to eliminate steps. Iterate over it. That's how I came up with Edit This Page. 3 steps to edit. At the outset was about 20. I think the same thing could be done with an Amazon-hosted SQL database.

@hasseily

This comment has been minimized.

Show comment
Hide comment
@hasseily

hasseily Oct 24, 2017

Just a quick comment that you should probably look at MariaDB instead of MySQL, it's pretty much a drop-in replacement but significantly improved.

hasseily commented Oct 24, 2017

Just a quick comment that you should probably look at MariaDB instead of MySQL, it's pretty much a drop-in replacement but significantly improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment