Instructions on installing and configuring MySQL on CentOS

Source: Internet
Author: User

1. Install MySQL database
 
You can install MySQL in CentOS5.4 in either of the following ways:
1. Install MySQL based on the source code package (I .e. the tar package;
2. MySQL installation Based on RPM packages;
 
The following describes how to install the source code package:
 
1. Unzip: tar-xzvf mysql-5.5.10-linux2.6-x86_64.tar.gz
 
2. Copy the unzipped installation package to the/usr/local directory (the installation directory of common software) and rename it to mysql.
 
Music mysql-5.5.10-linux2.6-x86_64/usr/locl/mysql
 
3. Enter the mysql directory cd/usr/local
 
4. You can create a user group and user for MySQL to start, close, and operate databases:
 
# Groupadd mysql // create a mysql Group
 
# Useradd-g mysql // Add a mysql user to the mysql Group
 
5. Users and user groups have been created, but this is not enough. To operate the database, you must have access to database-related files and directories.
 
Chown-R mysql. mysql.
 
6. scripts/mysql_install_db -- user = mysql -- datadir = data/
 
7. Grant the program ownership to "root" and the data directory ownership to users who can run "mysqld ".
 
Chown-R root.
 
Chown-R mysql data
 
9. cp support-files/my-medium.cnf/etc/my. cnf
 
Cp support-files/mysql. server/etc/init. d/mysql
 
10. ps-ef | remove mysql-related processes after grep mysqld
 
 
 
11. Use the mysql user to start the MySQL server. & indicates that the server is running in the background
 
Bin/mysqld_safe -- user = mysql &
 

 
Ii. Common Database Operations
 
1. the following commands can be used to connect to the MySQL server:
 
Mysql-h host address-u username-p Password
 
To connect to a local MySQL server, perform the following operations:
 
I. Open the terminal and enter the mysql/bin directory.
 
Ii. Enter the mysql-u root-p command and press enter to enter the password as prompted (here, the root user is used to log on, of course, you can also use the mysql user to log on)
 
Iii. If MySQL is just installed, the Super User root does not have a password, so press enter to enter. The system will display the MySQL prompt "mysql>"
 
2. Password Management
 
The database system can also manage user passwords. Users can add or modify passwords. If you have not set a password, you can add a password to the keystore. You can use the mysqladmin command with the password parameter to implement this.
 
Mysqladmin-u user name password New password
 
Mysqladmin-u username-p old password New password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.