1.输入 yum -y install mysql-server
[root@iZ25rdhqcmhZ ~]# yum -y install mysql-server
Loaded plugins: security
base | 3.7 kB 00:00
base/primary_db | 4.6 MB 00:01
epel | 4.4 kB 00:00
epel/primary_db | 6.5 MB 00:01
extras | 3.4 kB 00:00
extras/primary_db | 30 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================
Installing:
mysql-server x86_64 5.1.73-3.el6_5 base 8.6 M
Installing for dependencies:
mysql x86_64 5.1.73-3.el6_5 base 894 k
perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k
perl-DBI x86_64 1.609-4.el6 base 705 k
Transaction Summary
=================================================================================================================================
Install 4 Package(s)
Total download size: 10 M
Installed size: 29 M
Downloading Packages:
(1/4): mysql-5.1.73-3.el6_5.x86_64.rpm | 894 kB 00:00
(2/4): mysql-server-5.1.73-3.el6_5.x86_64.rpm | 8.6 MB 00:01
(3/4): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00
(4/4): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------
Total 4.5 MB/s | 10 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI-1.609-4.el6.x86_64 1/4
Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 2/4
Installing : mysql-5.1.73-3.el6_5.x86_64 3/4
Installing : mysql-server-5.1.73-3.el6_5.x86_64 4/4
Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 1/4
Verifying : mysql-server-5.1.73-3.el6_5.x86_64 2/4
Verifying : mysql-5.1.73-3.el6_5.x86_64 3/4
Verifying : perl-DBI-1.609-4.el6.x86_64 4/4
Installed:
mysql-server.x86_64 0:5.1.73-3.el6_5
Dependency Installed:
mysql.x86_64 0:5.1.73-3.el6_5 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6
Complete!
2.配置mysql字符集UTF-8
[root@iZ25rdhqcmhZ ~]# vim /etc/my.cnf
4.MySQL初始环境设定
为MySQL的root用户设置密码
1.mysql -u root -p
2.输入密码
mysql>use mysql;
//添加用户,设置任何机器都可以访问
mysql>insert into mysql.user(Host,User,Password) values("%","localhost",password("***"));
更新所有的root用户密码都为你设置的 ***
mysql>update user set password=passworD("***") where user='root';
mysql>flush privileges; --->让修改生效