RedHat version: 6.2
Mysql version: mysql-5.5.19
Installation Package file name: mysql-5.5.19-linux2.6-x86_64.tar.gz
1. installation steps:
Download the mysql-5.5.19-linux2.6-i686.tar.gz package from the official network. Decompress this package and use it as a compiled file. You can directly modify the configuration without compiling or installing it yourself.
1. Copy the mysql-5.5.19-linux2.6-x86_64.tar.gz to the/opt directory
2. Decompress
# Tar-zxvf mysql-5.5.19-linux2.6-i686.tar.gz-C/usr/local /;
Note: It is very important to decompress the package to/usr/local /.
3. Rename the mysql-5.5.19-linux2.6-x86_64 folder to mysql
Note: The current mysql directory is/usr/local/mysql (if it is in another directory, there will be many Installation Problems)
4. Create Database User Groups and users
# Groupadd mysql
# Useradd-g mysql
5. Copy the mysql STARTUP script mysql. server to the/etc/rc. d/init. d directory and name it mysql;
# Cp support-files/mysql. server/etc/rc. d/init. d/mysql
7. Copy the mysql configuration file my-medium.cnf to the/etc/directory, named my. cnf;
# Cp support-files/my-medium.cnf/etc/my. cnf
8. Modify the mysql directory permission;
# Chown-R root/usr/local/mysql // change the user of the mysql directory
# Chgrp-R mysql/usr/local/mysql // change the group of the mysql directory
# Chown-R mysql/usr/local/mysql/data // change the user of the data Directory, which is used to store the database
9. Generate a mysql System database. Run/usr/local/mysql/scripts/mysql_install_db to install the authorization table.
#/Usr/local/mysql/scripts/mysql_install_db -- user = mysql &
10. Start the mysql service. Run/usr/local/mysql/bin/mysqld_safe.
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql &
If Starting mysqld daemon with database from/usr/local/mysql/data is displayed, the mysql server is started normally.
11. Start the mysql Service
#/Etc/rc. d/init. d/mysql start
12. Start mysql
#/Usr/local/mysql/bin/mysql
Mysql>
At this point, mysql is done. You can operate the database and change the administrator password ......
Notes for starting mysql:
(1) To start mysql, you must first start the mysql_safe service (step 1 above ).
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql &
(2) Start the mysql service (step 1 above)
#/Etc/rc. d/init. d/mysql start
(3) Start mysql
#/Usr/local/mysql/bin/mysql
Ii. logon to mysql:
(1) If you are already in the/usr/local/mysql/bin directory
Run: #./mysql
If the root user sets a password
Run:
./Mysql-u root-p
Enter the mysql root Password and press Enter.
(2) If you are in another directory
Run: #/usr/local/mysql/bin/mysql
If the root user sets a password
Run:
/Usr/local/mysql/bin/mysql-u root-p
Enter the mysql root Password and press Enter.
Iii. Enable mysql to start automatically in Linux
In the decompress package/usr/local/MySQL/support-files of the mysql installer, there is a STARTUP script program named myslq. server. Copy it to the/etc/rc. d/init. d directory:
# Cd/etc/rc. d/init. d
# Cp/usr/local/mysql/support-files/mysql. server mysql
Change its attribute to "x" (executable, executable)
# Chmod + x mysql
Finally, run chkconfig to add MySQL to the startup Service Group of your system.
Run chkconfig -- add mysql