Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

linux - Connecting to Mysql on AWS Elastic Beanstalk

I am relatively new LAMP dev who is trying to learn Linux primarily through AWS. I have a live Elastic Beanstalk instance up and running. I did a yum install of the following packages:

mysql55.x86_64 mysql55-bench.x86_64 mysql55-common.x86_64 mysql55-devel.x86_64 mysql55-libs.x86_64 mysql55-server.x86_64 mysql55-test.x86_64 

Which all seemed to install fine ... then typed ...

mysql -V 

which gets me

mysql Ver 14.14 Distrib 5.5.20, for Linux (x86_64) using readline 5.1 

... which confirms mysql is installed ... but then when I type ...

mysql -u ec2-user -p
Enter password: /*leaving blank*/

I get ...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Now the thing is I am ssh-ing into this server with a Security Group key pair I created in AWS Console. So the key is authenticating me (from the .ppk file) when I log into the box as ec2-user. That IS my "root" user as far as I know, there is no password, but I may be mistaken.

So, basically I don't understand the basics of how to begin using MySQL in a linux environment. I've only really used PHPMyAdmin and the MySQL command line from WAMP until now.

Can somebody help me with where I'm getting my wires crossed here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Whoa. Hold up. Before you do anything else, stop and spin up your mysql machine outside of beanstalk, or use Amazon RDS. Beanstalk is designed to autoscale the web tier of your application, not hold your database. The moment it scales your application up, that new machine won't have your data. The moment it scales back down, it might remove your database machine. If that instance ends up on retired or corrupt hardware, beanstalk will replace it.

Give the Beanstalk architectural overview a read. Note the diagram. Your database layer exists outside the beanstalk environment, not in it.

In this diagram the beanstalk environment is delineated by the broken yellow line.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...