First step: [[email protected] ~]# Yum List | grep MySQL View package information for MySQL database
Step two: [[email protected] ~]# yum-y install mysql-server mysql mysql-devel installing MySQL packet
Step three: [[email protected] ~]# Rpm-qi mysql-server View details of MySQL software
Fourth step: [[email protected] ~]# service mysqld Restart initialize MySQL services
Fifth step: Restart the MySQL service, set to boot
[Email protected] ~]# service mysqld restart
Stop mysqld: [OK]
Starting mysqld: [OK]
[Email protected] ~]# Chkconfig--list | grep mysqld
Mysqld 0: Off 1: Off 2: Off 3: Off 4: off 5: off 6: Off
[Email protected] ~]# chkconfig mysqld on
[Email protected] ~]# Chkconfig--list | grep mysqld
Mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
[Email protected] ~]#
[Email protected] ~]# NETSTAT-TUNLP | grep mysqld
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3092/mysqld
Sixth step: Initialize the MySQL password
[Email protected] ~]# mysqladmin-u root password ' 123456 '
Seventh step: Log in to MySQL database
[[email protected] ~]# mysql-u root-p-P detect user's password
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 4
Server version:5.1.73 Source Distribution
Eighth step: View the MySQL configuration file
[Email protected] ~]# cd/etc/
[[email protected] etc]# ls my.cnf
My.cnf
[email protected] etc]# cat MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
[Email protected] etc]#
Nineth Step: The location of MySQL database file storage
[Email protected] ~]# cd/var/lib/mysql/
[Email protected] mysql]# pwd
/var/lib/mysql
[[email protected] mysql]# ls
Ibdata1 ib_logfile0 ib_logfile1 mysql mysql.sock test
[Email protected] mysql]#
Tenth step: The location of MySQL log file storage
Bye
[Email protected] ~]# cd/var/log/
Mysqld.log
11th Step: Connect the remote MySQL database
[Email protected] ~]# mysql-h 192.168.0.167 (shanghai.cpipec.com)-U root-p
12th step: Connect to the local MySQL database
[Email protected] ~]# mysql-h localhost-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 10
Server version:5.1.73 Source Distribution
13th step: View the MySQL database version
Mysql> select version ();
+-----------+
| Version () |
+-----------+
| 5.1.73 |
+-----------+
1 row in Set (0.00 sec)
14th Step: View the system default database
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Test |
| Yinhe |
+--------------------+
4 rows in Set (0.00 sec)
15th step: Check the current time
Mysql> Select Current_date;
+--------------+
| current_date |
+--------------+
| 2015-04-02 |
+--------------+
1 row in Set (0.00 sec)
Operation completed, if there is a problem please contact me in time!
This article is from the "Sky of Lavender" blog, be sure to keep this source http://youlei.blog.51cto.com/2669714/1652955
Installation of MySQL database under centos6.5 system