MySQL installation (Binary installation mode), mysql binary
MySQL installation (RPM installation mode) and directory structure
MySQL installation (Binary installation mode)
MySQL installation (source code installation mode)
This article uses the binary mode for installation:
View the current system: File/sbin/init
Various:
Download Mysql Official Website:
Http://dev.mysql.com/downloads/mysql/ (the current system is selected by default)
Http://dev.mysql.com/downloads/mirrors.html (other image addresses)
Oracle official download: https://edelivery.oracle.com/
FTP download: http://ftp.iij.ad.jp/pub/db/mysql/Downloads/
Which one can download from the list? Which is a binary package?
See official instructions: http://dev.mysql.com/doc/refman/5.1/en/binary-installation.html
Binary version format:Mysql-VERSION-OS.tar.gz (e.g., mysql-5.6.23-linux.tar.gz)
Mysql in the current example(Size: 289 M):
Http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.6/mysql-5.6.23-linux-glibc2.5-i686.tar.gz
Decompression path:
Cd/usr/local/src/
Tar zxvfmysql-5.6.23-linux-glibc2.5-i686.tar.gz
Move to the directory/usr/local/and rename it mysql:
Music mysql-5.6.23-linux-glibc2.5-i686/usr/local/mysql
Add users and groups:
Groupadd mysql
Useradd-g mysql
Set the owner and group of the mysql directory:
Chown-R mysql: mysql
Initialize mysql:
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
In the first and last red boxes, refer to the prompts. Copy the service and configuration file to the system configuration file:
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my. cnf
Edit the mysql configuration file and add the following parameters: vi/etc/my. cnf
[Mysqld]
Basedir =/usr/local/mysql
Datadir =/usr/local/mysql/data
Port = 3306
Server_id = 1
Start the mysqld service:
/Etc/rc. d/init. d/mysqld start
Another method for starting the mysqld service (see the prompt ):
/Usr/local/mysql/bin/mysqld_safe &
# This is the Startup File recommended to start the mysqld service in Unix and NetWare.
# For more information, see mysqld_safe-MySQL Server Startup Script.
Set the mysql root Password:
/Usr/local/mysql/bin/mysqladmin-u root password 'mysql'
To ensure security, use mysql_secure_installation to set:
/Usr/local/mysql/bin/mysql_secure_installation
# (Content truncation :)
NOTE: runningall parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!
............
Entercurrent password for root (enter for none): # If you have set the root password, enter it. Otherwise, leave it blank.
............
You alreadyhave a root password set, so you can safely answer 'n '.
Changethe root password? [Y/n] y # Do you want to change the root password? (Because I have already set it)
New password:
Re-enter newpassword:
............
Removeanonymous users? [Y/n] y # Do You Want To remove Anonymous users?
............
Disallowroot login remotely? [Y/n] y # Do you want to disable remote root logon?
............
Removetest database and access to it? [Y/n] n # Do you want to remove the test database?
............
Reloadprivilege tables now? [Y/n] y # Do You Want To reload the permission table?
............
Cleaning up...# Done!
The socket file path for the client to communicate with the server after mysql is started:
/Tmp/mysql. sock
When mysqld_safe is used to start the mysqld service, a log file is generated:
/Var/log/mysqld. log
Installation is complete!
Delete mysql now (directly Delete All mysql-related files in binary installation mode ):
Rm-f/etc/init. d/mysqld
Rm-f/etc/my. cnf
Find/-namemysql # search for the mysql directory and delete it.
Find/-name "mysql *" # first Delete the one found above, and then find out to continue deleting. Be sure to delete it!