1. Install with yum
Yum install mysql-Server
# Yum-y install PHP-MySQL
2. Change the password
Vim/etc/My. CNF
[Mysqld]
Add the following here: Set the default value to utf8.
Default-character-set = utf8
Add the following statement at the end of the configuration file:
[MySQL]
Default-character-set = utf8
3. Start the MySQL Service
Set the MySQL service to start with the System
[Root @ fangsh ~] # Chkconfig mysqld on
Check that MySQL is self-started.
[Root @ fangsh ~] # Chkconfig -- list mysqld
Mysqld 0: off 1: off 2: On 3: On 4: On 5: on 6: Off (if 2--5 is on, it is OK)
Start MySQL Service
[Root @ sample ~] # Service mysqld start
Initializing MySQL database: [OK]
Starting MYSQL: [OK]
After starting the service, you are prompted to change the password. Of course, no password is required.
--------------------------------------------------------------------------
4. log on
After MySQL is installed, if the root user is not set a password. You can log on as follows:
[Root @ fangsh ~] # Mysql-u root (use the root user to log on to the MySQL server)
Password setting is available.
[Root @ fangsh ~] # Mysql-u root-P (and then renew the password)
Welcome to the MySQL monitor. commands end with; or \ G.
Your MySQL connection ID is 2 to server version: 4.1.20
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Finally, you can view the user information as follows. Of course, the password is encrypted.
Mysql> Select User, host, password from mysql. user;
-- End