The Linux installation MySQL service is installed in two ways:
① source installation, the advantage is that the installation package is relatively small, only more than 10 m, the disadvantage is that the installation depends on the library, installation time is long, the installation steps are complex and error-prone;
② uses the official compiled binary file installation, the advantage is the installation speed, the installation step is simple, the disadvantage is that the installation package is large, about 300M. The following describes Linux using an officially compiled binary package to install MySQL.
Tools/Materials
- Mysql-5.6.17-linux-glibc2.5-i686.tar.gz
- Mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz
- Linux system, 32-bit, 64-bit can
Method/Step
to MySQL website download mysql compiled binary installation package, on the download page select Platform: Option Select Linux-generic, then pull the page to the bottom, 64-bit system download linux-generic (GLIBC 2.5) (x86, 64-bit), 32-bit system download linux-generic (GLIBC 2.5) (x86, 32-bit)
Unzip the 32-bit installation package:
Go to the directory where the installation package is located, execute the command: Tar mysql-5.6.17-linux-glibc2.5-i686.tar.gz
Copy the extracted MySQL directory to the local software directory of the system:
Execute command: CP mysql-5.6.17-linux-glibc2.5-i686/usr/local/mysql-r
Note: The end of the directory does not add/
Add system MySQL Group and MySQL User:
Execute command: Groupadd MySQL and useradd-r-g MySQL MySQL
To install the database:
Go to install MySQL software directory: Execute command cd/usr/local/mysql
Modify current directory owner for MySQL User: Execute command chown-r mysql:mysql.
Install database: Executes the command./scripts/mysql_install_db--user=mysql
Modify the current directory owner as root User: Execute command chown-r root:root.
Modify the current data directory owner for MySQL User: Execute command chown-r mysql:mysql data
To this database installation is complete
Start the MySQL service and add the boot MySQL service:
Add Boot: Execute command CP Support-files/mysql.server/etc/init.d/mysql, put startup script into boot initialization directory
Start MySQL service: Execute command service MySQL start
Execute command: ps-ef|grep mysql see MySQL service description started successfully,
To modify the root user password of MySQL, the root initial password is empty:
Execute command:./bin/mysqladmin-u root password ' password '
- 8
Put the MySQL client on the default path:
Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql
Note: It is recommended to use the soft chain in the past, do not directly package file copy, easy to install multiple versions of MySQL system
Linux system installation MySQL