In server construction, database construction is an indispensable part. As the most widely used relational database management system at present, MySQL has excellent stability, security and scalability, so it is widely used in various website applications, data analysis, embedded systems and other fields. This article will introduce in detail how to install MySQL under CentOS6.5 system.
Before installing the software, we need to update our system first to ensure that the operating system is up to date. Use the following command to update the system:
yum -y update
Use the yum command to install MySQL with one click:
yum -y install mysql-server mysql
After the MySQL installation is completed, we need to perform some basic configurations, such as starting the MySQL service, setting up auto-start, etc.
Use the following command to start the MySQL service:
service mysqld start
Use the following command to set auto-start at boot:
chkconfig mysqld on
After the MySQL installation is completed, we need to log in to MySQL to perform some basic configuration, such as creating databases, users, etc.
Use the following command to log in to MySQL:
mysql -u root -p
When MySQL is installed by default, the password of the root user is empty, we need to perform a Change of initial password. After logging in to MySQL, execute the following command:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
Use the following command to create a new database:
CREATE DATABASE test;
Delete an existing database:
DROP DATABASE test;
Use as follows Command to create a normal user:
GRANT ALL PRIVILEGES ON test.* TO 'username'@'localhost' IDENTIFIED BY 'password';
The test.* here indicates that the user has operating permissions for all tables under the test database.
Use the following command to query the created user permissions:
SHOW GRANTS FOR 'username'@'localhost';
Use the following command to delete a user:
DROP USER 'username'@'localhost';
The above are the detailed steps for installing MySQL under CentOS6.5. It should be noted that the root user should not be revealed during the installation process. password, and a complex password should be set to prevent attacks. After the installation is complete, MySQL should be properly configured and optimized to ensure its performance and security.
The above is the detailed content of How to install mysql on centos6.5. For more information, please follow other related articles on the PHP Chinese website!