0

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?

3
  • Check your mysqld is running. try /etc/init.d/mysqld restart and then connect to mysql Commented Jul 12, 2012 at 3:06
  • my /etc/init.d/ doesn't contain anything mysql* related ... no such file or directory Commented Jul 12, 2012 at 3:37
  • I ended up resolving this on my own, by reinstalling the mysql rpms one at a time - think it was mysql-server that wasn't installed. Still don't know why mysql -V showed it was installed when it wasn't and also need to learn how to quickly determine what is and isn't installed. But this was helpful. Commented Jul 12, 2012 at 6:59

2 Answers 2

4

It's not intended for you to run MySQL on your Elastic Beanstalk instance. If you need to use MySQL, you are supposed to run it on a separate instance, or use Amazon RDS. The reason for this is that your instance is not persistent and can be restarted at any time without warning from the original AMI. If that happens, goodbye database.

There's an extended discussion of this issue on the AWS forums.

That said, if you're just testing, jnizjo's instructions will get the MySQL server up and running for you.

1
  • Thank you for this answer, which gets to my underlying question. Yes, I'm learning linux, but I'm also learning how to configure architectures in AWS. I'll read those threads tonight. Commented Jul 12, 2012 at 6:55
2

You need to start MySQL:

# chkconfig mysql on # service mysql start 

Check MySQL server:

# ps aux | grep mysqld mysql 3098 2.3 9.1 326852 34912 ? Ssl 09:27 0:00 /usr/sbin/mysqld 

And logs:

# less /path_to_mysql_log 
3
  • chkconfig mysql on displays: error reading information on service mysql: No such file or directory and ps aux | grep displays: root 8926 0.0 0.1 103444 832 pts/0 S+ 03:42 0:00 grep mysqld if I can't chkconfig on mysql, but it will give me a mysql -V ... what does that mean? Commented Jul 12, 2012 at 3:44
  • OK, I guess mysql-server never got installed when I did the yum install on so many packages all at once ... I have mysqld in my etc/init.d now ... That should solve it! Thank you for setting on the path to figuring it out. Commented Jul 12, 2012 at 3:53
  • OK, I guess mysql-server never got installed when I did the yum install on so many packages all at once ... I have mysqld in my etc/init.d now ... and I'm at the mysql> command line That should solve it! Commented Jul 12, 2012 at 3:58

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.