This article will share with you my first notes on installing mysql 5.6.10 on Ubuntu Server 12.04. I hope you can learn from each other more.
First download the binary mysql package: http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
Because wget on Ubuntu Server is slow, I downloaded it directly with thunder on windows and uploaded it to the Server using WinSCP.
Correct question.
Package in ~ In the/Download directory, all the installation commands are as follows:
1、decompress tar.gz
| The Code is as follows: |
Copy code |
Tar-xzf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz |
2. Rename the decompressed folder
| The Code is as follows: |
Copy code |
Music mysql-5.6.10-linux-glibc2.5-x86_64 mysql |
3. Move the mysql folder to the/usr/local directory.
| The Code is as follows: |
Copy code |
Sudo mv mysql/usr/local |
4. Go to the mysql directory
| The Code is as follows: |
Copy code |
Cd/usr/local/mysql |
5. Add a mysql user group
| The Code is as follows: |
Copy code |
Sudo groupadd mysql |
6. Add mysql users
| The Code is as follows: |
Copy code |
Sudo useradd-r-g mysql |
7. Change the mysql folder own and grp to mysql
| The Code is as follows: |
Copy code |
Sudo chown-R mysql. Sudo chgrp-R mysql. |
8. Execute the mysql installation script
| The Code is as follows: |
Copy code |
Sudo scripts/mysql_install_db -- user = mysql |
(If the libaio package is not installed, an error message is displayed. After libaio-dev is installed, run the script again)
| The Code is as follows: |
Copy code |
Sudo apt-get install libaio-dev |
9. Change the directory permission back and only keep the data directory as a mysql user
| The Code is as follows: |
Copy code |
Sudo chown-R root. Sudo chown-R mysql data |
10. Copy the mysql configuration file to the etc directory (global configuration)
Note: The default configuration file name of version 5.6 is changed from my-medium to my-default.
| The Code is as follows: |
Copy code |
Sudo cp support-files/my-default.cnf/etc/my. cnf |
11. Start mysql
| The Code is as follows: |
Copy code |
Sudo bin/mysqld_safe -- user = mysql & |
12. initialize the mysql root User Password
| The Code is as follows: |
Copy code |
Sudo bin/mysqladmin-u root password 'password text' |
13. Copy the mysql. server script to/etc/init. d (initialize the service. Some people prefer to change it to mysqld. You can change it here)
| The Code is as follows: |
Copy code |
Sudo cp support-files/mysql. server/etc/init. d/mysql. server |
14. view the mysql running status
Sudo service mysql. server status
If it runs normally, MySQL running is displayed.
If not running is displayed, the service is not started before. You can directly start it with service mysql. server start.
| The Code is as follows: |
Copy code |
Sudo service mysql. server [status | start | stop] |
15. Enable mysql to start [defaults], and disable [remove]
| The Code is as follows: |
Copy code |
Sudo update-rc.d-f mysql. server defaults [remove] |
16. Add the mysql/bin/mysql command to the USER command, or add the mysql/bin directory to the path
Add USER command:
| The Code is as follows: |
Copy code |
Sudo ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql |
Add environment variables:
| The Code is as follows: |
Copy code |
Export PATH = $ PATH:/usr/local/mysql/bin |
17. Allow the root user to log on remotely.
| The Code is as follows: |
Copy code |
1> enter mysql: mysql-u root-p 2> change the database: use mysql; 3> log on from any host: grant all privileges on *. * to root @ "%" identified by "Password text" with grant option; 4> log on from the specified host: grant all privileges on *. * to root @ "192.168.1.101" identified by "passw0rd" with grant option; 5> authorization takes effect: flush privileges; 6> check if the host is % authorized to add: select * from user; |