1. Download the four required rpm installation packages from the mysql website (which must be downloaded from the official website to prevent data modification and expires changes:
Http://dev.mysql.com/downloads/mysql/5.0.html#linux-rhel5-ia64-rpms
MySQL-client-5.1.16-0.glibc23.i386.rpm
MySQL-devel-5.1.16-0.glibc23.i386.rpm
MySQL-server-5.1.16-0.glibc23.i386.rpm
MySQL-shared-5.1.16-0.glibc23.i386.rpm
2. Use the ssh remote control tool to upload it to the server and place it in the appropriate directory (for example,/opt/mysql/mysql5.1.16)
3. Go to the directory (/opt/mysql/mysql5.1.16) and install msyql:
The rpm file is a software installation package developed by Red Hat. rpm frees Linux from complicated procedures when installing software packages. The frequently used parameter of this command during installation is-ivh, where I indicates that the specified rmp package will be installed, and V indicates the detailed information during installation, h indicates that the "#" symbol appears during the installation to display the current installation process. This symbol will not stop until the installation is complete.
[Root @ qudee mysql5.1.16] # rpm-ivh MySQL-client-5.1.16-0.glibc23.i386.rpm
[Root @ qudee mysql5.1.16] # rpm-ivh MySQL-devel-5.1.16-0.glibc23.i386.rpm
[Root @ qudee mysql5.1.16] # rpm-ivh MySQL-shared-5.1.16-0.glibc23.i386.rpm
[Root @ qudee mysql5.1.16] # rpm-ivh MySQL-server-5.1.16-0.glibc23.i386.rpm
The following information is displayed:
Warning: MySQL-server-5.1.16-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ######################################## ### [100%]
1: mySQL-server ##################################### ###### [100%]
Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:
/Usr/bin/mysqladmin-u root password 'new-password'
/Usr/bin/mysqladmin-u root-h localhost password 'new-password'
See the manual for more instructions.
NOTE: If you are upgrading from a MySQL <= 3.22.10 you shoshould run
The/usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
Able to use the new GRANT command!
Please report any problems with the/usr/bin/mysqlbug script!
The latest information about MySQL is available on the web
Http://www.mysql.com
Support MySQL by buying support/licenses athttps: // order.mysql.com
Starting MySQL...
4. View installed packages
[Root @ qudee mysql5.1.20] # rpm-qa | grep-I mysql
Or [root @ qudee mysql5.1.20] # rpm-qa | grep mysql
MySQL-devel-5.1.20-0.glibc23
MySQL-shared-5.1.20-0.glibc23
MySQL-client-5.1.20-0.glibc23
MySQL-server-5.1.20-0.glibc23
5. view the [root @ qudee/] # locate mysql. server path
/Usr/share/man/man1/mysql.server.1.gz
/Usr/share/mysql. server
Copy and rename [root @ qudee/] # cp/usr/share/mysql. server/etc/init. d/mysqld
6. view the path of the [root @ qudee/] # locate my-huge.cnf
/Usr/share/doc/MySQL-server-5.1.16/my-huge.cnf
/Usr/share/mysql/my-huge.cnf.
Copy and rename [root @ qudee/] # cp/usr/share/mysql/my-huge.cnf/etc/my. cnf
7. Start the service:
Service mysqld start
Starting MySQL [OK]
Started successfully! Congratulations ~~~
8. Edit the vi/etc/my. cnf file, set the character set, and support internationalization.
Default-character-set = utf8 // Add a character set here
# Here follows entries for some specific programs
# The MySQL server
[Mysqld] port = 3306
# Socket =/var/lib/mysql. sock
Skip-locking
Key_buffer = 384 M
Max_allowed_packet = 1 M
Table_cache = 512
Sort_buffer_size = 2 M
Read_buffer_size = 2 M
Read_rnd_buffer_size = 8 M
Myisam_sort_buffer_size = 64 M
Thread_cache_size = 8
Query_cache_size = 32 M
Default-character-set = utf8 // Add a character set here
# Try number of CPU's * 2 for thread_concurrency
Thread_concurrency = 16
Press Esc first, and then Shift +; then enter wq! (Release and save)
Haha! The character set is configured ~~~
9. The default data file storage directory of MySQL is/var/lib/mysql. To move the directory to/qudeedata/dbdata/mysql5.1.16, perform the following steps:
(1) Create the mysql5.1.16 directory under the/qudeedata/dbdata directory
Cd/qudeedata/dbdata
Mkdir mysql5.1.16
(2) Stop the MySQL service process:
Service mysqld stop
(3) Move the entire/var/lib/mysql directory to/qudeedata/dbdata/mysql5.1.16
Mv/var/lib/mysql/qudeedata/dbdata/mysql5.1.16
In this way, the MySQL data file is moved to/qudeedata/dbdata/mysql5.1.16.
(4) edit the MySQL configuration file/etc/my. cnf
To ensure that MySQL works properly, you must specify the location where the mysql. sock file is generated. Modify the right value of a socket =/var/lib/mysql. sock Line with the medium number:
/Qudeedata/dbdata/mysql5.1.16/mysql. sock. The procedure is as follows:
Command: vi my. cnf (use the vi tool to edit the my. cnf file and find the following data to modify)
# The MySQL server
[Mysqld]
Port = 3306
# Socket =/var/lib/mysql. sock)
Socket =/qudeedata/dbdata/mysql5.1.16/mysql. sock (add this line)
(5) modify the MySQL STARTUP script/etc/rc. d/init. d/mysqld
Finally, you need to modify the MySQL STARTUP script/etc/rc. d/init. d/mysqld: change the path on the right of the "datadir =/var/lib/mysql" column to your actual storage path:
/Qudeedata/dbdata/mysql5.1.16.
[Root @ test1 etc] # vi/etc/rc. d/init. d/mysqld
# Datadir =/var/lib/mysql (comment this row)
Datadir =/qudeedata/dbdata/mysql5.1.16 (add this row)
10. Automatic Start
1) Check whether mysql is in the Auto Start List
[Root @ qudee/] # chkconfig-list
2) Add MySQL to the startup Service Group of your system.
[Root @ qudee/] # chkconfig-add mysql
11. test whether the command can be started, stopped, or restarted
Result:
[Root @ qudee/] # service mysqld start
Starting MySQL [OK]
[Root @ qudee/] # service mysqld restart
Shutting down MySQL... [OK]
Starting MySQL [OK]
[Root @ qudee/] # service mysqld stop
Shutting down MySQL... [OK]
[Root @ qudee/] #/etc/init. d/mysqld start
Starting MySQL [OK]
[Root @ qudee/] #/etc/init. d/mysqld restart
Shutting down MySQL... [OK]
Starting MySQL [OK]
[Root @ qudee/] #/etc/init. d/mysqld stop
Shutting down MySQL... [OK]
It indicates that mysql is successfully installed. Note: You can also add, query, and delete data in the database.
12. Complete the installation!