信息來源鏈接:
http://www.centoscn.com/mysql/2014/1211/4290.html
安裝
# 通過yum命令安裝mysql
yum install -y mysql-server mysql mysql-deve
查看安裝mysql版本
# 通過rpm查看mysql版本信息
rpm -qi mysql-server
Name : mysql-server Relocations: (not relocatable)
Version : 5.1.73 Vendor: CentOS
Release : 8.el6_8 Build Date: Fri 27 Jan 2017 06:25:43 AM CST
Install Date: Sat 15 Apr 2017 06:56:05 PM CST Build Host: c1bm.rdu2.centos.org
Group : Applications/Databases Source RPM: mysql-5.1.73-8.el6_8.src.rpm
Size : 25884131 License: GPLv2 with exceptions
Signature : RSA/SHA1, Fri 27 Jan 2017 06:35:28 AM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://www.mysql.com
Summary : The MySQL server and related files
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.
配置
# 修改密碼
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZ28nvy56w8Z password 'new-password'
# 查看服務(wù)是否開機(jī)自動(dòng)啟動(dòng)
chkconfig --list | grep mysqld
# 設(shè)置mysql服務(wù)開機(jī)自動(dòng)啟動(dòng)
chkconfig mysqld on
[root@user~]# chkconfig --list|grep mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@user~]# chkconfig mysqld on
[root@user~]# chkconfig --list|grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
使用
# 啟動(dòng)
service mysqld start
# 初始化信息
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZ28nvy56w8Z password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
# 登錄
mysql -u root -p