linuxDownloadmysqlUnzipInstallationProcess (centos redhat has been used for N rounds in the production environment)
1.Upload mysql-5.5.29-linux2.6-x86_64.tar.gz file to the opt directory
2. Enter the opt directory to decompress the file#tar -zxvf mysql-5.5.29-linux2.6-x86_64.tar.gz
3. Create mysql user group #groupadd mysql
4. Create a mysql user and join the mysql user group #useradd mysql -g mysql -p 1234567890 -s /sbin/nologin -M
5. Create a soft link #ln -s mysql-5.5.29-linux2.6-x86_64 mysql
6. (Explanation, the following /opt/mysql/ path must be consistent, if it is /opt/mysql, then keep this consistent)
#cd mysql #chown -R mysql . #chgrp -R mysql . #scripts/mysql_install_db --user=mysql --datadir=/opt/mysql/data/ #chown -R root . #chown -R mysql data #cp support-files/my-medium.cnf /etc/my.cnf (128M内存) 或者cp support-files/my-large.cnf /etc/my.cnf(512M内存) 或者cp support-files/my-huge.cnf /etc/my.cnf (1-2G内存) 或者cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf(4G内存)
Modify the port and other configurations in the my.cnf file
#vi /etc/my.cnf
(1). Change the 3306 port in two places to 13316
( 2), Maximum number of connections and innodb_file_per_table settings. Turn on
At the end of
# The MySQL server
[mysqld]
, add
max_connections=3100 innodb_file_per_table=1
#bin/mysqld_safe --user=mysql & Wait a few minutes before executing (press Enter)
Copy file#cp support-files/mysql.server /etc/init.d/mysql
Then modify /etc/ init.d/mysql file
basedir=/opt/mysql datadir=/opt/mysql/data
Look down, these are changed to this (associated with the mysql path of the decompression installation):
basedir=/opt/mysql bindir=/opt/mysql/bin datadir=/opt/mysql/data sbindir=/opt/mysql/bin libexecdir=/opt/mysql/bin
Automatic startup# chkconfig --add mysql
#chkconfig mysql on
Stop#service mysql stop If the Punrecognized service error is reported: chmod 755 /etc/rc.d/init.d/mysql
Start#service mysql start
#cd ../
Initialize the password of the administrator root#/opt/mysql/bin/mysqladmin -u root password '1234567890'
Enable the root account to be used for local and remote connections#/opt/mysql/ bin/mysql -u root -p
Enter the initial good password 1234567890
mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "1234567890"; mysql>flush privileges;
Create other accounts
mysql>GRANT ALL PRIVILEGES ON *.* TO abcd@"%" IDENTIFIED BY "abcd#123456"; mysql>flush privileges; mysql>quit;
View mysql process
#ps -ef |grep mysql
Come on, give yourself a like, it’s completed, please keep working hard.
【Related recommendations】
1. Free mysql online video tutorial
2. MySQL latest manual tutorial
3. Chuanzhi Podcast Liu Daocheng MySql series video tutorials
The above is the detailed content of Teach you an example of how to quickly install mysql. For more information, please follow other related articles on the PHP Chinese website!