Linux(Centos)installationMysqlDatabaseuninstalling the original database
1, the query system has no database installed
Rpm-qa | grep MySQL
2. uninstalling the original database
RPM-E MySQL//normal Delete mode
RPM-E--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted
UseYumInstalling the Database
1.query The database version provided by Yum
Yum List | grep MySQL
2. Install the database
Yum install-y mysql-server MySQL 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 does not start: mysql:unrecognized service
Use:
/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 powered up
Chkconfig--list | grep mysqld
6. Set Boot start
Chkconfig mysqld on
7 , set the initial password for the MySQL database root user
/usr/bin/mysqladmin-u root password ' new-password '
Or
Mysqladmin-u root password ' root '
Mysqlthe configuration file1,
/etc/my.cnfthis isMysqlthe master configuration file
query content Cat ETC/MY.CNF
[Email protected] desktop]# CAT/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/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/mysqld.pid
2,
/var/lib/mysqlMysqlDatabase file storage location for database
[Email protected] lib]# CD mysql/
[email protected] mysql]# LL
Total 20488
-RW-RW----. 1 mysql mysql 10485760 Feb 1422:52 ibdata1
-RW-RW----. 1 mysql mysql 5242880 Feb 22:52 ib_logfile0
-RW-RW----. 1 mysql mysql 5242880 Feb 22:52 ib_logfile1
DRWX------. 2 mysql mysql 4096 Feb 22:51 MySQL
Srwxrwxrwx. 1 mysql mysql 0 Feb 22:52 mysql.sock
DRWX------. 2 mysql mysql 4096 Feb 22:51 test
3./var/logmysql database log output storage location
Linix (Centos) install MySQL