Installing MySQL 5.6 in Amazon Linux Machine

2020-06-06 02:37发布

I am trying to install MySQL 5.6 in amazon linux machine. by using following link.

after completing following steps.

sudo yum localinstall http://repo.mysql.com/mysql-community-release-el6-3.noarch.rpm
sudo yum install mysql-community-server

when i am starting mysql services by this command.

sudo service mysqld start

I am getting MySQL Daemon failed to start error.

3条回答
一夜七次
2楼-- · 2020-06-06 03:28

Starting from 2015 Sep, Mysql 5.6 server is now natively available through Amazon yum repos. More info @ https://aws.amazon.com/blogs/aws/now-available-amazon-linux-ami-2015-09/

You can now simply install Mysql 5.6 server using

sudo yum install mysql56-server

Then you can simply start/stop/status look using the regular service commands

service mysqld start ( restart | stop | status |  )

I couldn't figure out the default root password in Amazon AMI then I simply reset the root user password by starting the mysqld service with skip grant tables

mysqld_safe --skip-grant-tables start
mysql -u root 
update user set password=PASSWORD('[New Password]') where User='root';

OR

/usr/libexec/mysql56/mysqladmin -u root password 'new password'

Also, you need to run the following command to upgrade the MySQL database to 5.6

sudo mysql_upgrade -u root -p
查看更多
聊天终结者
3楼-- · 2020-06-06 03:32

Remove old mySql

sudo yum remove mysql mysql-server mysql-common mysql-client

remove all pre-installed packages. You can get a list:

rpm -qa | grep -i mysql

Then uninstall all of them. For example:

rpm -e mysql libmysqlclient15-5.0.94-0.2.4.1 <and so on>

Completely remove the /var/lib/mysql folder

    cd /var/lib
    rm -rf mysql

Installing fresh mySql 5.6 =>

    wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.23-1.el7.x86_64.rpm-bundle.tar
    tar -xvf MySQL-5.6.23-1.el7.x86_64.rpm-bundle.tar
    sudo yum -y install MySQL-client-5.6.23-1.el7.x86_64.rpm
    sudo yum install MySQL-shared-compat-5.6.23-1.el7.x86_64.rpm
    sudo yum install MySQL-server-5.6.23-1.el7.x86_64.rpm
查看更多
ら.Afraid
4楼-- · 2020-06-06 03:37

I met the same problem on my micro instance. Check your mysql logs If the issue is because of InnoDB: Cannot allocate memory for the buffer pool Adding a swap page might solve the problem. It solved for me. You can follow this setup

http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html

I copied the contents if the page does not loads

Amazon EC2 Micro Instance Swap Space - Linux I have a Amazon EC2 Linux Micro instance. Since Micro instances have only 613MB of memory, MySQL crashed every now and then. After a long search about MySQL, Micro Instance and Memory Managment I found out there is no default SWAP space for Micro instance. So if you want to avoid the crash you may need to setup a swap space for your micro instance. Actually performance wise is better to enable swap.

Steps below show how to make a swap space for your Micro instance. I assume you have AWS Account with a Micro instance running.

Run dd if=/dev/zero of=/swapfile bs=1M count=1024
Run mkswap /swapfile
Run swapon /swapfile
Add this line /swapfile swap swap defaults 0 0 to /etc/fstab
Step 4 is needed if you would like to automatically enable swap file after each reboot.

Some useful command related to SWAP space:
$ swapon -s
$ free -k
$ swapoff -a
$ swapon -a

查看更多
登录 后发表回答