Last active
February 11, 2017 00:22
-
-
Save mezrin/6151570 to your computer and use it in GitHub Desktop.
Install MySQL 5.6 on the Ubuntu 12.10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download deb file | |
#https://dev.mysql.com/downloads/mysql/5.6.html | |
#Specify deb file location | |
mysql_deb=/path/mysql-5.6.13-debian6.0-x86_64.deb | |
echo "Installing package 'libaio'..." | |
sudo apt-get -y -qq install libaio1 | |
echo "Installing MySQL 5.6..." | |
sudo dpkg -i $mysql_deb | |
echo "Adding mysql user & group..." | |
sudo groupadd mysql | |
sudo useradd -r -g mysql mysql | |
echo "Create mysql data folder..." | |
sudo mkdir /opt/mysql/server-5.6/data | |
sudo chown -R mysql:mysql /opt/mysql/server-5.6/data | |
echo "Now we can create and configure the database. Initialize data..." | |
sudo /opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql | |
sudo chown -R mysql:mysql /opt/mysql/server-5.6/data | |
echo "Copy configuration files..." | |
sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server | |
sudo cp /opt/mysql/server-5.6/support-files/my-default.cnf /etc/my.cnf | |
sudo cp /opt/mysql/server-5.6/support-files/mysql-log-rotate /etc/logrotate.d/mysql.server | |
echo "Configure start-up launch script..." | |
sudo chmod 755 /etc/init.d/mysql.server | |
sudo update-rc.d mysql.server defaults | |
sudo invoke-rc.d mysql.server start | |
echo "Before we start the server, let's make sure MySQL is only going to be using the one configuration file." | |
sudo mv /opt/mysql/server-5.6/my.cnf /opt/mysql/server-5.6/my.cnf.notused | |
echo "Change PATH to access mysql from the command line" | |
sudo echo '' >> /etc/bash.bashrc | |
sudo echo '#MySQL PATH variable' >> /etc/bash.bashrc | |
sudo echo 'export PATH=$PATH:/opt/mysql/server-5.6/bin' >> /etc/bash.bashrc | |
echo "LogOut and LogIn again to apply PATH variable" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Specify root password | |
root_pass=12345 | |
echo "Restart MySQL..." | |
sudo service mysql.server restart | |
echo "Setting root password..." | |
/opt/mysql/server-5.6/bin/mysql -u root \ | |
-e "UPDATE mysql.user SET Password=PASSWORD('$root_pass') WHERE User='root';" \ | |
-e "FLUSH PRIVILEGES;" | |
echo "Secure the whole installation..." | |
/opt/mysql/server-5.6/bin/mysql -u root --password=$root_pass \ | |
-e "DELETE FROM mysql.user WHERE User='';" \ | |
-e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" \ | |
-e "DROP DATABASE test;" \ | |
-e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';" \ | |
-e "FLUSH PRIVILEGES;" | |
echo "Include shared libraries" | |
sudo echo "/opt/mysql/server-5.6/lib" > /etc/ld.so.conf.d/mysql.conf | |
sudo ldconfig | |
echo "Restart MySQL..." | |
sudo service mysql.server restart | |
echo "Finished installing MySQL." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installation of the MySQL 5.6 on the Ubuntu 12.10. | |
Should work for 12.04, 13.10 | |
It's a fresh installation. On the computer should not be installed any previous versions of MySQL | |
Another tutorials: | |
https://gist.github.com/jebenexer/5790236 | |
https://gist.github.com/michfield/5578726 | |
http://www.peterchen.net/2013/02/20/en-how-to-install-mysql-5-6-on-ubuntu-12-04-precise/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment