Today, the leader asked me to install mysql in the production environment using a compilation-free method, so I had the following content. The directory involved in it has been processed. Please modify it as needed!
1. Download the mysql compilation-free package:
1 wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
2. Set the mysql directory:
Tar-zxvf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
Music mysql-5.6.14-linux-glibc2.5-x86_64/usr/local/mysql
Groupadd mysql
Useradd-g mysql-M mysql
Mkdir-p/work/mysql/data
Chown-R mysql. mysql/work/mysql/data
3. initialize the MySQL database:
# Tip: run the following command to check whether the system does not have/etc/my. cnf before initializing and installing mysql.
/Usr/local/mysql/scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/work/mysql/data -- user = mysql
4. Add mysqld as a system service and set it to self-start:
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig mysqld on
5. Start mysql:
/Etc/init. d/mysqld start
6. Set the password:
/Usr/local/mysql/bin/mysqladmin-u root password 'your password'
7 about my. cnf:
The my. cnf file for mysqld-5.5 and later versions is automatically installed under/usr/local/mysql/my. cnf when Initialization is performed. In addition, it mainly modifies the option configuration.
8 faults:
Fatal error: Can't open and lock privilege tables: Table 'mysql. user' doesn' t exist
Solution:
This problem is that you need to reinitialize the mysql database.
Mysql_install_db -- basedir =/usr/local/mysql -- datadir =/work/mysql/data -- user = mysql
9 about my. cnf:
/Usr/local/mysql/my. cnf
# For advice on how to change settings please see
# Http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[Mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# Cache in MySQL. Start at 70% of total RAM for dedicated servers, else 10%.
Innodb_buffer_pool_size = 128 M
# Remove leading # to turn on a very important data integrity option: logging
# Changes to the binary log between backups.
# Log_bin
# These are commonly set, remove the # and set as required.
Basedir =/usr/local/mysql
Datadir =/work/mysql/data
Port = 3306
# Server_id = .....
Socket =/tmp/mysql. sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
Join_buffer_size = 128 M
Sort_buffer_size = 2 M
Read_rnd_buffer_size = 2 M
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
Ps: You can create a one-click installation script based on the above content. In this way, you don't have to wait as long as before.
How to install MySQL 6.4 in RHEL 5.6 (i386)
Linux website architecture series-Apache-deployment
Complete MySQL installation and master-slave dual-machine configuration
Install MySQL database in rpm mode on RHEL6 Platform
RedHat 6.3 MySQL-server-5.6.13-1.el6.x86_64.rpm Installation
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04