Cd/da
Prerequisites: Yum lib (yum install *)-bash (problem with environment variable) command not found (configuration file error)
1. Build MySQL user useradd MySQL
2. Create Data Catalog Mkdir-p/data/mysql
4. Create profile directory/etc/my.cnf (upload my.cnf file to/etc directory)
5. Install the package on the/opt/soft/
6. Unpack the package: TAR-ZXVF absolute path mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz-c/usr/local
7. Renaming: The package name after MV decompression MySQL
(in/usr/local) (name changed)
8. Set permissions: cd/usr/local chown mysql:mysql-r MySQL
Cd/data/chown Mysql:mysql-r/data
Reinitialize to kill the process, to delete everything in/data/mysql RM-RF *
9. Initialize (in the installation directory CD to Usr/local/mysql/script):./mysql_install_db--datadir=/data/mysql--DEFAULTS-FILE=/ETC/MY.CNF--
Basedir=/usr/local/mysql--user=mysql
Export Mysql_home=/usr/local/mysql
10. Modify Environment Variables: Vim/etc/profile Add export path= "$PATH: $MYSQL _home/bin" Save exit on the last line
Effective Source/etc/profile
11. Start MySQL (in the installation directory under CD to Bin):./mysqld_safe--defaults-file=/etc/my.cnf--user=mysql &
12. See if there is a process: Ps-ef|grep MySQL
12.mysql successfully entered
13. First login to MySQL after entering the environment: use MySQL;
Cleanup environment: Delete from user where user!= ' root ' or host!= ' localhost ';
14. Add password to MySQL: Update set PASSWORD=PASSORWD (' 123456 ') where user= ' root ';
15. Modify MySQL login password: Update user set Password=password (' 123456 ') where user= ' root ';
16. Refresh permissions: Flush privileges; Exit
17. After changing the password, re-login: mysql-uroot-p Password: 123456
18. Turn off MySQL two ways:
1, normal shutdown: mysqladmin shutdown-uroot-p 123456
2, non-normal shutdown, suitable for the experimental environment: PS-EF | grep MySQL ———————— kill-9
The second way is not recommended, in practice do not do so
19. Turn on MySQL mode:./mysql-safe--defaults-file=/etc/my.cnf--user=mysql&
20. Forgotten Password Solution 1
1.ps-ef|grep MySQL (filter. All MySQL-related lists)
2.kill-9 2110 (Process number) 1520 (process number) (Kill process)
3. Go to MySQL to modify MySQL login password: Update user set Password=password (' 123456 ') where user= ' root ';
Forgot Password Solution 2
1../mysqld_safe--defaults-file=/etc/my.cnf--skip-grant-tables&
2. Go to MySQL to modify MySQL login password: Update user set Password=password (' 123456 ') where user= ' root ';
3. Refresh permissions: Flush privileges;
Authorization: Grant all privileges on * * to ' Zhang ' @ '% ' identified by ' 123456 ';
If you find the old version
[Email protected] local]# Rpm-qa | grep MySQL
Mysql-libs-5.1.71-1.el6.x86_64
[Email protected] local]# rpm-e mysql-libs-5.1.71-1.el6.x86_64--nodeps
[Email protected] local]# Rpm-qa | grep MySQL
Multi-instance installation;
Create the Data directory under/directory to create mysql_3306 and mysql_3308 in the data directory
1, upload the installation package mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz to the/opt/soft directory
2, unzip the installation package TAR-ZXVF mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz-c/usr/local. and change the extracted name to MySQL.
3. See if there are no MySQL users created, CD-to-home directory LS under look (or cat/etc/passwd see if there is no MySQL user (useradd mysql created MySQL user)
4, upload the configuration file duo.cnf to/etc
5, initialize before starting, enter to/usr/local/mysql/scripts under initialization.
./mysql_install_db (Initialize execution command)--defaults-file=/etc/dan.cnf (config file)--basedir=/usr/local/mysql (Setup file)--datadir=/data/ mysql_3306 or mysql_3308 (data file)--user=mysql (plus this initialization is done without having to modify the user's permissions again)
or input initialization command; USR/LOCAL/MYSQL/SCRIPTS/MYSQL_INSTALL_DB--DEFAULTS-FILE=/ETC/MY.CNF--basedir=/usr/local/mysql-- datadir=/data/mysql_3306--user=mysql
and usr/local/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/usr/local/mysql--datadir=/data/ mysql_3308--user=mysql
Note: Initialization occurs when two OK is initialized successfully.
Boot into the/usr/local/mysql/bin directory
Permission denied error This is a permissions issue (Modify Permissions Chown mysql:mysql MySQL. )
6, start, Mysqld_multi start 3306
Mysqld_multi Start 3308
7, view, Mysqld_multi report
Enter, Mysql_3306-uroot-p
Mysql_3308-uroot-p
Change all port numbers (:%s/3306/3308/g)
Initialize 3306 and 3308 port numbers, initialized two times, respectively
Authorization: Grant all privileges on * * to ' ZS ' @ ' 192.168.56.% ' identified by ' 123456 '
Refresh Permissions: Flush Privileges
Bulk Modify port number Grant Update >flush privileges (refresh)
See who links me: Show full processlist;
Single-instance and multi-instance installation of MySQL