This document describes how to install MySql in Linux.
Environment: OS: Centos 6.5x64 & MySql 5.1x64
1. system check
Check whether the MySql database is installed.
[root@master ~]# rpm -qa | grep mysql
If yes, uninstall the installed MySql database first.
[Root @ master ~] # Rpm-e mysql // normal deletion mode [root @ master ~] # Rpm-e -- nodeps mysql // strong deletion mode. if the above command is used to delete other dependent files, you can use this command to forcibly delete them.
2. install the database
[root@master ~]# yum install -y mysql-server mysql mysql-devel
View installation status
[Root @ master ~] # Rpm-qi mysql-serverName: mysql-server Relocations: (not relocatable) Version: 5.1.73Vendor: CentOSRelease: 3. el6_5 Build Date: Thursday, June 17, 39 seconds Install Date: Thursday, June 24, Build Host: c6b9. bsys. dev. centos. orgGroup: Applications/DatabasesSource RPM: mysql-5.1.73-3.el6_5.src.rpmSize: 25882723 License: GPLv2 with predictionssignature: RSA/SHA1, Thursday, February 13, 2014, Key ID 0946fca2c105b9dePackager: CentOS BuildSystem
URL: The MySQL server and related filesDescription: MySQL is a multi-user, multi-threaded SQL database server. mySQL is aclient/server implementation consisting of a server daemon (mysqld) and has different client programs and libraries. this package containsthe MySQL server and some accompanying files and directories.
3. Manage databases
START database
[Root @ master ~] # Service mysqld start initialize MySQL database: Installing MySQL system tables... OKFilling help tables... OKTo start mysqld at boot time you have to copysupport-files/mysql. server to the right place for your systemPLEASE 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 master password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. this isstronugly recommended for production servers. see the manu Al for more instructions. you can start the MySQL daemon with: cd/usr;/usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.plcd/usr/mysql-test; perl mysql-test-run.plPlease report any problems with the/usr/bin/mysqlbug script! [OK] starting mysqld: [OK]