Uninstall the original database 1. check whether the system has installed the database rpm-qa | grepmysql2. uninstall the original database rpm-emysql // general deletion mode rpm-e -- nodepsmysql // strong deletion mode, if you detach the original database
1. check whether the system has installed the database.
Rpm-qa | grep mysql
2. uninstall the original database
Rpm-e mysql // normal deletion mode
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.
Use yum to install the database
1. query the database version provided by yum.
yum list | grep mysql
2. install the database
Yum install-y mysql-server mysql-deve
3. view the installed database version
rpm -qi mysql-server
4. start the database
4.1、service mysqld start
4.2、
If the 4.1 command cannot be started: mysql: unrecognized service
Usage:
/etc/rc.d/init.d/mysqld start
Modify file permissions
chmod 755 /etc/rc.d/init.d/mysqld
You can use:
service mysqld start
Start
5. check whether the database is started.
chkconfig --list | grep mysqld
6. set startup
chkconfig mysqld on
7. set the initial password of the root user of the mysql database
/usr/bin/mysqladmin -u root password 'new-password'
Or
mysqladmin -u root password 'root'
Mysql configuration file 1,
/Etc/my. cnfThis is the main configuration file of mysql.
Query content cat etc/my. cnf
[Root @ bogon Desktop] # cat/etc/my. cnf
[Mysqld]
Datadir =/var/lib/mysql
Socket =/var/lib/mysql. sock
User = mysql
# Disabling symbolic-links is recommendedto prevent assorted security risks
Symbolic-links = 0
[Mysqld_safe]
Log-error =/var/log/mysqld. log
Pid-file =/var/run/mysqld. pid
2,
/Var/lib/mysqlDatabase file storage location of the mysql database
[Root @ bogon lib] # cd mysql/
[Root @ bogon mysql] # ll
Total 20488
-Rw ----. 1 mysql 10485760 Feb 1422: 52 ibdata1
-Rw ----. 1 mysql 5242880 Feb 14 ib_logfile0
-Rw ----. 1 mysql 5242880 Feb 14 ib_logfile1
Drwx ------. 2 mysql 4096 Feb 14 mysql
Srwxrwxrwx. 1 mysql 0 Feb 14 mysql. sock
Drwx ------. 2 mysql 4096 Feb 14 test
3./Var/logLog output location of the mysql database