Today, the company has built an Alibaba Cloud server, to install the mysql database on it, as a technology that has never installed the mysql database in CentOS6.5, I am looking for it online. The information was recorded and then recorded.
Step: Check if the mysql database is installed on the server.
Execute command: rpm -qa | grep mysql
Step 2: If the first step has checked that the system has installed the mysql database, first kill the mysql database in the original system. If the mysql database is installed in the system, the screenshot of the contents of the first step command is as follows:
Then delete the original database and execute the following command:
rpm -e mysql;//Generally delete if If you are prompted to rely on other files, you can't delete
rpm -e --nodeps mysql;//strongly delete it. If there are other dependent files, you can delete it strongly
third step: through yum Mysql installation
execute the command: yum install -y mysql-server mysql mysql-devel / / mysql, mysql-server, mysql-devel are installed
After executing the command, the database successfully installed screenshots are as follows :
Step 4: After the database installation is successful, check the mysql-server command
Execute command: rpm -qi mysql-server
Step 5: Start mysql service
Execute command :service mysqld start
The installation of the mysql database here is coming to an end.
The following is a few more records in the record:
1, check whether the mysql database service is set to boot itself?
Execute command: chkconfig --list | grep mysqld
After executing the command, the screenshot is as follows:
From the above screenshot, you can know that the mysql database service boot automatically shuts down, execute the command: chkconfig Mysqld on; set the mysql database service to boot automatically.
Execute the command chkconfig --list |grep mysqld and find that the boot automatically starts:
2, after the mysql database is installed, there is only one root administrator account, but the root account is not yet Set the password, then how to set the root user password, change the root user password, execute the sql command to log in to the mysql database?
When the mysql service is started for the first time, the database initialization operation will be performed, and a lot of information will be output. In this information we can see: /usr/bin/mysqladmin -u root password 'new-password'
This command means to set the password for the root account, execute the command mysqladmin -u root password 'root'; / / Use this command to set the password for the root account to root
, then we can execute the command. :mysql -u root -p to log in to our database