Operating System:Ubuntu 12.04 LTS 64 bits
MySQL Version:5.6.14
Installation File type:Binary, compressed in mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
Download:http://fossies.org/linux/misc/mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz/cloc.html
I believe that installing MySQL in other versions of ubuntu should be similar or exactly same, like ubuntu 13.04, etc
The file you download is a compressed package that include all the files that are necessary for the installation, the only thing you need to do is to unzip the files into a location that you want the MySQL be installed in. Remember, these are compiled files and they are different from a source package which requires you to use make command to compile and use make install command to install.
If you install MySQL from source code, the only difference is that you need to compile those source files and use make install to install them as specified in ./configure command before you compile. While in here, you only need to unzip the package to a directory, and the installation is completed after you done that.
1. Unzip mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz into /usr/local/mysql-5.6.14/ directory
sudo tar zxvf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
(Note: after you done the above command, you should be able to see there is mysql-5.6.14 directory in /usr/local)
Next, you probably will need to create a symbolic link to that directory so that you can refer to mysql more easily regardless of its version number, you do like this:
Next, you probably will need to create a symbolic link to that directory so that you can refer to mysql more easily regardless of its version number, you do like this:
cd /usr/local
ln -s /usr/local/mysql-5.6.14 mysql
(so now you create a symbolic link mysql in /usr/local to point to the /usr/local/mysql-5.6.14 directory)
The /usr/local/mysql-5.6.14 directory after unzip:
The /usr/local/mysql-5.6.14 directory after unzip:
you need to create a group and a user for MySQL, let's just call the group name and the user name both mysql
Create group:
3. Change the owner of directory /usr/local/mysql-5.6.14/ to the user mysql
5. Use mysql_install_db to initialize the authorization table
6. Configure mysql service
Create group:
sudo groupadd mysql
Create user:sudo useradd -r -g mysql mysql
(Note: sudo useradd -r -g groupname username, the user mysql is created for the purpose of controlling the right of files, using '-r' will allow this user no need to login)3. Change the owner of directory /usr/local/mysql-5.6.14/ to the user mysql
sudo chown -R mysql:mysql /usr/local/mysql-5.6.14
4. Install the shared library libaio1sudo apt-get install libaio1
sudo scripts/mysql_install_db --user=mysql
(a) Enter /etc/init.d/
(b) Create a symbolic link to mysql service
or you can copy the mysql.server file into the /etc/init.d directory, this directory controls all the services that are need to start at the boot of the operating system.
(c) Change to ownership of mysql service to the user mysql
cd /etc/init.d
sudo ln -s /usr/local/mysql-5.6.14/support-files/mysql.server mysql.server
(c) Change to ownership of mysql service to the user mysql
sudo chown -R mysql:mysql mysql
(d) Start mysql:
sudo /etc/init.d/mysql.server start
7. Check whether mysql service is running or not
ps -aux | grep mysql
8. Check mysql's version, enter /usr/local/mysql
bin/mysqladmin version
As we can see, MySQL is installed successfully.
Now we need to configure MySQL, we call it post-installation
1. create password for the root user of mysqlFirst, enter mysql's installation directory, mysql is by default installed in /usr/local/mysql :
cd /usr/local/mysql
Then, type in a new password:
Then, do instructions as following:./bin/mysqladmin -u root password '123456'
2. Security configuration, including deleting Test database and anonymous operations.
sudo bin/mysql_secure_installation
- NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
- SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
- In order to log into MySQL to secure it, we'll need the current
- password for the root user. If you've just installed MySQL, and
- you haven't set the root password yet, the password will be blank,
- so you should just press enter here.
- Enter current password for root (enter for none):
- OK, successfully used password, moving on...
- Setting the root password ensures that nobody can log into the MySQL
- root user without the proper authorisation.
- You already have a root password set, so you can safely answer 'n'.
- Change the root password? [Y/n] n
- ... skipping.
- By default, a MySQL installation has an anonymous user, allowing anyone
- to log into MySQL without having to have a user account created for
- them. This is intended only for testing, and to make the installation
- go a bit smoother. You should remove them before moving into a
- production environment.
- Remove anonymous users? [Y/n] y
- ... Success!
- Normally, root should only be allowed to connect from 'localhost'. This
- ensures that someone cannot guess at the root password from the network.
- Disallow root login remotely? [Y/n] y
- ... Success!
- By default, MySQL comes with a database named 'test' that anyone can
- access. This is also intended only for testing, and should be removed
- before moving into a production environment.
- Remove test database and access to it? [Y/n] y
- - Dropping test database...
- ... Success!
- - Removing privileges on test database...
- ... Success!
- Reloading the privilege tables will ensure that all changes made so far
- will take effect immediately.
- Reload privilege tables now? [Y/n] y
- ... Success!
- All done! If you've completed all of the above steps, your MySQL
- installation should now be secure.
- Thanks for using MySQL!
- Cleaning up...
3. Configure the startups.
sudo update-rc.d mysql.server defaults
Add the mysql/bin into system PATH, need to edit /etc/profile:
sudo vim /etc/profile
export PATH="$PATH:/usr/local/mysql/bin"
Or, you can edit a /etc/environment file directly to achieve a system wide effect:
Now, save the file and restart the computer, and then you will be able to use mysql in any directory
Configuration complete. now you can use the new installed mysql!
sudo vim/etc/environment
Configuration complete. now you can use the new installed mysql!
mysql 5.6.14 win32 good post nice work admin..keep it up:)
ReplyDeleteThanks Man, You made my day with no trouble.
ReplyDelete