CentOS上安装MySQL
1、准备RPM安装包
MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
MySQL-client-5.6.33-1.linux_glibc2.5.x86_64
2、检查并清理旧版
[root@localhost Desktop]# rpm -qa | grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[root@localhost Desktop]# rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
[root@localhost Desktop]# rm -rf /var/lib/mysql*
[root@localhost Desktop]# rm -rf /usr/share/mysql*
3、安装Server
[root@localhost Desktop]# rpm -ivh /root/Desktop/MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm
warning: /root/Desktop/MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
2016-12-13 03:19:31 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-13 03:19:31 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 35882 ...
2016-12-13 03:19:31 35882 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-12-13 03:19:31 35882 [Note] InnoDB: The InnoDB memory heap is disabled
2016-12-13 03:19:31 35882 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-13 03:19:31 35882 [Note] InnoDB: Memory barrier is not used
2016-12-13 03:19:31 35882 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-12-13 03:19:31 35882 [Note] InnoDB: Using Linux native AIO
2016-12-13 03:19:31 35882 [Note] InnoDB: Using CPU crc32 instructions
2016-12-13 03:19:31 35882 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-12-13 03:19:31 35882 [Note] InnoDB: Completed initialization of buffer pool
2016-12-13 03:19:31 35882 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-12-13 03:19:31 35882 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-12-13 03:19:31 35882 [Note] InnoDB: Database physically writes the file full: wait...
2016-12-13 03:19:32 35882 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-12-13 03:19:35 35882 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-12-13 03:19:37 35882 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-12-13 03:19:37 35882 [Warning] InnoDB: New log files created, LSN=45781
2016-12-13 03:19:37 35882 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-12-13 03:19:37 35882 [Note] InnoDB: Doublewrite buffer created
2016-12-13 03:19:37 35882 [Note] InnoDB: 128 rollback segment(s) are active.
2016-12-13 03:19:37 35882 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-12-13 03:19:37 35882 [Note] InnoDB: Foreign key constraint system tables created
2016-12-13 03:19:37 35882 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-12-13 03:19:37 35882 [Note] InnoDB: Tablespace and datafile system tables created.
2016-12-13 03:19:37 35882 [Note] InnoDB: Waiting for purge to start
2016-12-13 03:19:37 35882 [Note] InnoDB: 5.6.33 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2016-12-13 03:19:37 35882 [Note] Binlog end
2016-12-13 03:19:37 35882 [Note] InnoDB: FTS optimize thread exiting.
2016-12-13 03:19:37 35882 [Note] InnoDB: Starting shutdown...
2016-12-13 03:19:38 35882 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2016-12-13 03:19:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-13 03:19:39 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 35906 ...
2016-12-13 03:19:39 35906 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-12-13 03:19:39 35906 [Note] InnoDB: The InnoDB memory heap is disabled
2016-12-13 03:19:39 35906 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-13 03:19:39 35906 [Note] InnoDB: Memory barrier is not used
2016-12-13 03:19:39 35906 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-12-13 03:19:39 35906 [Note] InnoDB: Using Linux native AIO
2016-12-13 03:19:39 35906 [Note] InnoDB: Using CPU crc32 instructions
2016-12-13 03:19:39 35906 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-12-13 03:19:39 35906 [Note] InnoDB: Completed initialization of buffer pool
2016-12-13 03:19:39 35906 [Note] InnoDB: Highest supported file format is Barracuda.
2016-12-13 03:19:39 35906 [Note] InnoDB: 128 rollback segment(s) are active.
2016-12-13 03:19:39 35906 [Note] InnoDB: Waiting for purge to start
2016-12-13 03:19:39 35906 [Note] InnoDB: 5.6.33 started; log sequence number 1625977
2016-12-13 03:19:39 35906 [Note] Binlog end
2016-12-13 03:19:39 35906 [Note] InnoDB: FTS optimize thread exiting.
2016-12-13 03:19:39 35906 [Note] InnoDB: Starting shutdown...
2016-12-13 03:19:41 35906 [Note] InnoDB: Shutdown completed; log sequence number 1625987 A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'. You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag. Also, the account for the anonymous user has been removed. In addition, you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test database.
This is strongly recommended for production servers. See the manual for more instructions. Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
4、启动MySQL服务
[root@localhost Desktop]# service mysql start
Starting MySQL................... SUCCESS!
5、查看默认密码
[root@localhost Desktop]# more /root/.mysql_secret
# The random password set for the root user at Tue Dec 13 03:19:37 2016 (local t
ime): YPkX6RUWvFNRxYuc
6、安装Client
[root@localhost Desktop]# rpm -ivh /root/Desktop/MySQL-client-5.6.33-1.linux_glibc2.5.x86_64.rpm
warning: /root/Desktop/MySQL-client-5.6.33-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
7、执行安全向导
[root@localhost Desktop]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Enter current password for root (enter for none): YPkX6RUWvFNRxYuc <–初次运行直接回车
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y <– 是否设置root用户密码,输入y并回车或直接回车
New password: 123456 <– 设置root用户的密码
Re-enter new password: 123456 <– 再输入一次你设置的密码
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y <– 是否删除匿名用户,生产环境建议删除,所以直接回车
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
... skipping. By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] n <– 是否删除test数据库,直接回车
... skipping. Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] y <– 是否重新加载权限表,直接回车
... Success! All done! If you've completed all of the above steps, your MySQL
installation should now be secure. Thanks for using MySQL! Cleaning up...
8、配置my.cnf
[root@localhost Desktop]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL. [mysqld] #socket = /var/lib/mysql/mysql.sock
#datadir = /var/lib/mysql/mysql character-set-server=utf8
lower_case_table_names=1 # Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin # These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = ..... # Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
9、重启服务
[root@localhost Desktop]# service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
10、关闭防火墙
[root@localhost Desktop]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
11、测试连接

参考资料:
http://www.linuxidc.com/Linux/2015-01/111744.htm
CentOS上安装MySQL的更多相关文章
- 在centos上安装mysql
本文依然是用的xftp上传gz文件,然后在xShell上操作的,如果没有安装使用这两个文件的请查阅之前的博客. 1.将下载好的文件用xftp上传到对应的位置. 2.解压文件:tar -zvxf m ...
- Linux1 在Linux(CentOS)上安装MySql详细记录
前记: 毕业两年了,前两天换了份工作,由以前的传统行业跳到了互联网行业.之前的公司一直在用WinServer2003+Tomcat+SqlServer/Oracle这套部署环境.对于Linux+To ...
- [Linux] 使用Yum在CentOS上安装MySQL
跟随官网上的安装教程:https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html官网上还有一个QuickGuide ...
- [从零开始搭网站七]CentOS上安装Mysql
点击下面连接查看从零开始搭网站全系列 从零开始搭网站 通过前面6章,我们买好了服务器,配置了服务器连接,服务器上配置了JDK和Tomcat,准备了域名(这个我没教,自己去阿里/百度/腾讯买,买东西我相 ...
- Linux CentOS上安装 MySQL 8.0.16
前言: 因为我需要在我新安装的Linux CentOS系统服务器中安装和配置MySQL服务器,然而对于我们这种Linux使用小白而言在Linux系统中下载,解压,配置MySQL等一系列的操作还是有些耗 ...
- 使用yum方式在centOS上安装mysql
1.操作系统及MySQL版本 1.1 操作系统版本 CentOS release 6.5 (Final) 1.2 MySQL版本 mysql-5.1.73-3.el6_5.x86_64mysql-li ...
- 在CentOS上安装Mysql使用yum安装mysql
https://jingyan.baidu.com/article/c74d600079be530f6a595dc3.html
- 【linux系列】Centos下安装mysql数据库
前言 为了测试方便,通常我们会自己安装数据库,以下是在Centos上安装Mysql的操作. 一.检查自己是否安装了MySQL数据库 [root@s201 /home/mysql]#rpm -qa |g ...
- centOS上安装MySQL5.7
在centos上安装mysql,前提得有sudo的权限.没有的话先去跟管理员申请一个. STEP 1 - 安装MySQL 首先打开浏览器访问下 https://dev.mysql.com/downlo ...
随机推荐
- java第一课:环境、变量、数据类型
一.java编程注意事项1.java区分大小写2.每条语句结尾有分号3.上下级代码注意缩进4.大括号要成对出现5.标点符号要用英文半角(半角全角区别)二.eclipse1.eclipse是自编译及时编 ...
- 通过PLSQL Developer导入SQL文件
1.点击“工具” 2.选中其中的“导入表(L)”,在按下图所示操作: PLSQL Developer会自动运行相关命令,在Tables中刷新即可看到新导入的表.
- fiddler 插件开发二
本篇主要讲解Fildder插件开发中的涉及到的主要接口与类. 1.IFiddlerExtension 接口 如果要开发的自定义插件有UI界面,则需要实现IFiddlerExtension 接口.你程序 ...
- DLL搜索路径和DLL劫持
DLL搜索路径和DLL劫持 环境:XP SP3 VS2005 作者:magictong 为什么要把DLL搜索路径(DLL ORDER)和DLL劫持(DLL Hajack)拿到一起讲呢?呵呵,其实没啥深 ...
- 【leetcode】Longest Common Prefix (easy)
Write a function to find the longest common prefix string amongst an array of strings. 思路:找最长公共前缀 常规 ...
- jmeter 测试java协议经验总结
对java协议的良好支持,是jmeter比loadrunner优秀的地方,但是坑也不少,本文将相关点都整理下来备忘 一. 依赖的jar包 使用IDE开发jemter java协议脚本时,需要导入以下几 ...
- a标签的link、visited、hover、active的顺序
a标签的link.visited.hover.active是有一定顺序的,以下是我一直在用的一个顺序,能正确显示四个颜色,我也不知道有没有其他的顺序能正确显示,如果你没办法判断哪个是对的,那就先用这个 ...
- MyBatis的动态SQL操作--插入
需求:向数据库中插入一条数据 //id,name,sal非空,三个字段都插入 insert into student(id,name,sal) values (?,?,?) //id,name非空,只 ...
- !! Scrum之 流程和术语
!!Scrum之 流程和术语 http://www.cnblogs.com/zhoujg/archive/2009/07/15/1523680.html 以下将对一些术语进行简单介绍,以便大家现在开始 ...
- Netfilter&iptables:如何理解连接跟踪机制?
如何理解Netfilter中的连接跟踪机制? 本篇我打算以一个问句开头,因为在知识探索的道路上只有多问然后充分调动起思考的机器才能让自己走得更远.连接跟踪定义很简单:用来记录和跟踪连接的状态. 问:为 ...