CentOS7下使用Yum安装MySQL
来源:互联网 发布:数据显示为undefined 编辑:程序博客网 时间:2024/05/20 21:48
一. 下载MySQL Yum仓库的RPM安装包
1. 访问http://dev.mysql.com/downloads/repo/yum/
选择对应的RPM包下载,我使用的是CentOS7,所以选择Linux7的RPM包。若使用命令行方式下载,可在shell下使用wget下载
二. 安装MySQL RPM安装包
安装完成后会将MySQL的Yum仓库添加到系统的仓库list中,可以/etc/yum.repos.d目录下看到新增的两个文件(mysql-community.repo和mysql-community-source.repo)。
检查MySQL Yum仓库是否被添加成功。
三. 安装MySQL
[root@localhost yum.repos.d]# yum install mysql-community-serverFailed to set locale, defaulting to CLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.zju.edu.cn * updates: mirrors.zju.edu.cnResolving Dependencies--> Running transaction check---> Package mysql-community-server.x86_64 0:5.7.17-1.el7 will be installed--> Processing Dependency: mysql-community-common(x86-64) = 5.7.17-1.el7 for package: mysql-community-server-5.7.17-1.el7.x86_64--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.17-1.el7.x86_64--> Running transaction check---> Package mariadb.x86_64 1:5.5.52-1.el7 will be obsoleted---> Package mysql-community-client.x86_64 0:5.7.17-1.el7 will be obsoleting--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.17-1.el7.x86_64---> Package mysql-community-common.x86_64 0:5.7.17-1.el7 will be installed--> Running transaction check---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: perl-DBD-MySQL-4.023-5.el7.x86_64--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: mysql-connector-odbc-5.2.5-6.el7.x86_64--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:net-snmp-5.7.2-24.el7_2.1.x86_64--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: MySQL-python-1.2.5-1.el7.x86_64--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: perl-DBD-MySQL-4.023-5.el7.x86_64--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: mysql-connector-odbc-5.2.5-6.el7.x86_64--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: MySQL-python-1.2.5-1.el7.x86_64---> Package mysql-community-libs.x86_64 0:5.7.17-1.el7 will be obsoleting--> Running transaction check---> Package mysql-community-libs-compat.x86_64 0:5.7.17-1.el7 will be obsoleting---> Package mysql-connector-odbc.x86_64 0:5.2.5-6.el7 will be updated---> Package mysql-connector-odbc.x86_64 0:5.3.7-1.el7 will be an update--> Finished Dependency ResolutionDependencies Resolved=========================================================================================================================== Package Arch Version Repository Size===========================================================================================================================Installing: mysql-community-client x86_64 5.7.17-1.el7 mysql57-community 24 M replacing mariadb.x86_64 1:5.5.52-1.el7 mysql-community-libs x86_64 5.7.17-1.el7 mysql57-community 2.1 M replacing mariadb-libs.x86_64 1:5.5.52-1.el7 mysql-community-libs-compat x86_64 5.7.17-1.el7 mysql57-community 2.0 M replacing mariadb-libs.x86_64 1:5.5.52-1.el7 mysql-community-server x86_64 5.7.17-1.el7 mysql57-community 162 MInstalling for dependencies: mysql-community-common x86_64 5.7.17-1.el7 mysql57-community 271 kUpdating for dependencies: mysql-connector-odbc x86_64 5.3.7-1.el7 mysql-connectors-community 2.7 MTransaction Summary===========================================================================================================================Install 4 Packages (+1 Dependent package)Upgrade ( 1 Dependent package)Total download size: 193 MIs this ok [y/d/N]: yDownloading packages:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.17-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPublic key for mysql-community-common-5.7.17-1.el7.x86_64.rpm is not installed(1/6): mysql-community-common-5.7.17-1.el7.x86_64.rpm | 271 kB 00:00:02(2/6): mysql-community-libs-5.7.17-1.el7.x86_64.rpm | 2.1 MB 00:00:16(3/6): mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm | 2.0 MB 00:00:17Public key for mysql-connector-odbc-5.3.7-1.el7.x86_64.rpm is not installed ] 339 kB/s | 16 MB 00:08:51 ETA(4/6): mysql-connector-odbc-5.3.7-1.el7.x86_64.rpm | 2.7 MB 00:00:20(5/6): mysql-community-client-5.7.17-1.el7.x86_64.rpm | 24 MB 00:03:45(6/6): mysql-community-server-5.7.17-1.el7.x86_64.rpm | 162 MB 00:27:18---------------------------------------------------------------------------------------------------------------------------Total 118 kB/s | 193 MB 00:27:55Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlImporting GPG key 0x5072E1F5: Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package : mysql57-community-release-el7-9.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlIs this ok [y/N]: yRunning transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : mysql-community-common-5.7.17-1.el7.x86_64 1/9 Installing : mysql-community-libs-5.7.17-1.el7.x86_64 2/9 Installing : mysql-community-client-5.7.17-1.el7.x86_64 3/9 Installing : mysql-community-server-5.7.17-1.el7.x86_64 [################################## ] 4/9[root@localhost yum.repos.d]# yum install mysql-community-serverFailed to set locale, defaulting to CLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.zju.edu.cn Installing : mysql-community-server-5.7.17-1.el7.x86_64 4/9 Installing : mysql-community-libs-compat-5.7.17-1.el7.x86_64 5/9 Updating : mysql-connector-odbc-5.3.7-1.el7.x86_64 6/9Success: Usage count is 1Success: Usage count is 1 Erasing : 1:mariadb-5.5.52-1.el7.x86_64 7/9 Cleanup : mysql-connector-odbc-5.2.5-6.el7.x86_64 8/9 Erasing : 1:mariadb-libs-5.5.52-1.el7.x86_64 9/9 Verifying : mysql-community-common-5.7.17-1.el7.x86_64 1/9 Verifying : mysql-community-server-5.7.17-1.el7.x86_64 2/9 Verifying : mysql-connector-odbc-5.3.7-1.el7.x86_64 3/9 Verifying : mysql-community-libs-5.7.17-1.el7.x86_64 4/9 Verifying : mysql-community-libs-compat-5.7.17-1.el7.x86_64 5/9 Verifying : mysql-community-client-5.7.17-1.el7.x86_64 6/9 Verifying : 1:mariadb-5.5.52-1.el7.x86_64 7/9 Verifying : 1:mariadb-libs-5.5.52-1.el7.x86_64 8/9 Verifying : mysql-connector-odbc-5.2.5-6.el7.x86_64 9/9Installed: mysql-community-client.x86_64 0:5.7.17-1.el7 mysql-community-libs.x86_64 0:5.7.17-1.el7 mysql-community-libs-compat.x86_64 0:5.7.17-1.el7 mysql-community-server.x86_64 0:5.7.17-1.el7Dependency Installed: mysql-community-common.x86_64 0:5.7.17-1.el7Dependency Updated: mysql-connector-odbc.x86_64 0:5.3.7-1.el7Replaced: mariadb.x86_64 1:5.5.52-1.el7 mariadb-libs.x86_64 1:5.5.52-1.el7Complete![root@localhost yum.repos.d]#
安装完成后,会生成一个临时的随机密码给root账户,保存在/var/log/mysqld.log,可以使用命令查看。
四. 启动MySQL并检查其运行状态
五. 完成MySQL安全相关的设置
使用mysql_secure_installation程序执行重要的安全操作,如重设root密码,移除匿名账户等
[root@localhost log]# mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root:The existing password for the user account root has expired. Please set a new password.New password:Re-enter new password:The 'validate_password' plugin is installed on the server.The subsequent steps will run with the existing configurationof the plugin.Using existing password for root.Estimated strength of the password: 100Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : YBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : YSuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : YSuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : YSuccess.All done![root@localhost log]#
0 0
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- CentOS7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- centos7下使用yum安装mysql
- C++中继承的几大关键点
- css选择器
- Qt for Android on Mac:源码编译及环境配置
- [LeetCode]191. Number of 1 Bits
- 对象模型中类与类间的关系
- CentOS7下使用Yum安装MySQL
- Linux less命令总结
- tomcat宕机自动重启和每日定时启动tomcat
- Subscription expires on 2017/2/25. Usage of PhpStorm will no longer be possible.
- 获取元素的样式
- 2014第五届蓝桥杯预赛试题本科c++史丰收速算
- 弹幕生成--辐射吸收体
- RecyclerView复用ViewPager出现的问题
- 顺时针打印矩阵