centos6.8已经安装了mysql,所以要卸载掉

查看命令 rpm -qa | grep mysql

注意:MySQL区分大小写 grep mysql 和grep MySQL 是不一样的!!

卸载命令 yum remomve mysql(刚才查看到的安装包)

全文用的是绝对路径,所以不要在乎[root@master mysql]

我用的是CentOs6系统,首先下载MySql安装包,如下:

MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm

MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm

百度云链接:mysql-5.6.36

密码:qdsi

这个包的默认解压路径是/usr/share/mysql

[root@master ~]# cd /usr/local/mysql/

[root@master mysql]# ls

MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm

MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm

[root@master mysql]# rpm -ivh MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm   //安装mysql-server

warning: MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 





Signature, key ID 5072e1f5: NOKEY

Preparing...                                                            





(100%########################################### [100%]

   1:MySQL-server                                                       (  





1%########################################### [100%]

2017-04-12 00:26:36 0 [Note] Ignoring --secure-file-priv value as server is running with --



bootstrap.

2017-04-12 00:26:36 0 [Note] /usr/sbin/mysqld (mysqld 5.6.36) starting as process 8502 ...

2017-04-12 00:26:36 8502 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-04-12 00:26:36 8502 [Note] InnoDB: The InnoDB memory heap is disabled

2017-04-12 00:26:36 8502 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-04-12 00:26:36 8502 [Note] InnoDB: Memory barrier is not used

2017-04-12 00:26:36 8502 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-04-12 00:26:36 8502 [Note] InnoDB: Using Linux native AIO

2017-04-12 00:26:36 8502 [Note] InnoDB: Not using CPU crc32 instructions

2017-04-12 00:26:36 8502 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2017-04-12 00:26:36 8502 [Note] InnoDB: Completed initialization of buffer pool

2017-04-12 00:26:36 8502 [Note] InnoDB: The first specified data file ./ibdata1 did not 





exist: a new database to be created!

2017-04-12 00:26:36 8502 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2017-04-12 00:26:36 8502 [Note] InnoDB: Database physically writes the file full: wait...

2017-04-12 00:26:37 8502 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2017-04-12 00:26:38 8502 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2017-04-12 00:26:39 8502 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2017-04-12 00:26:39 8502 [Warning] InnoDB: New log files created, LSN=45781

2017-04-12 00:26:39 8502 [Note] InnoDB: Doublewrite buffer not found: creating new

2017-04-12 00:26:39 8502 [Note] InnoDB: Doublewrite buffer created

2017-04-12 00:26:39 8502 [Note] InnoDB: 128 rollback segment(s) are active.

2017-04-12 00:26:39 8502 [Warning] InnoDB: Creating foreign key constraint system 



tables.

2017-04-12 00:26:39 8502 [Note] InnoDB: Foreign key constraint system tables created

2017-04-12 00:26:39 8502 [Note] InnoDB: Creating tablespace and datafile system tables.

2017-04-12 00:26:39 8502 [Note] InnoDB: Tablespace and datafile system tables created.

2017-04-12 00:26:39 8502 [Note] InnoDB: Waiting for purge to start

2017-04-12 00:26:39 8502 [Note] InnoDB: 5.6.36 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2017-04-12 00:26:40 8502 [Warning] 'user' entry 'root@master' ignored in --skip-name-





resolve mode.

2017-04-12 00:26:40 8502 [Warning] 'proxies_priv' entry '@ root@master' ignored in --





skip-name-resolve mode.

2017-04-12 00:26:40 8502 [Note] Binlog end

2017-04-12 00:26:40 8502 [Note] InnoDB: FTS optimize thread exiting.

2017-04-12 00:26:40 8502 [Note] InnoDB: Starting shutdown...

2017-04-12 00:26:41 8502 [Note] InnoDB: Shutdown completed; log sequence number 



1625977



2017-04-12 00:26:41 0 [Note] Ignoring --secure-file-priv value as server is running with --





bootstrap.

2017-04-12 00:26:41 0 [Note] /usr/sbin/mysqld (mysqld 5.6.36) starting as process 8524 ...

2017-04-12 00:26:41 8524 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-04-12 00:26:41 8524 [Note] InnoDB: The InnoDB memory heap is disabled

2017-04-12 00:26:41 8524 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-04-12 00:26:41 8524 [Note] InnoDB: Memory barrier is not used

2017-04-12 00:26:41 8524 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-04-12 00:26:41 8524 [Note] InnoDB: Using Linux native AIO

2017-04-12 00:26:41 8524 [Note] InnoDB: Not using CPU crc32 instructions

2017-04-12 00:26:41 8524 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2017-04-12 00:26:41 8524 [Note] InnoDB: Completed initialization of buffer pool

2017-04-12 00:26:41 8524 [Note] InnoDB: Highest supported file format is Barracuda.

2017-04-12 00:26:41 8524 [Note] InnoDB: 128 rollback segment(s) are active.

2017-04-12 00:26:41 8524 [Note] InnoDB: Waiting for purge to start

2017-04-12 00:26:42 8524 [Note] InnoDB: 5.6.36 started; log sequence number 1625977

2017-04-12 00:26:42 8524 [Note] Binlog end

2017-04-12 00:26:42 8524 [Note] InnoDB: FTS optimize thread exiting.

2017-04-12 00:26:42 8524 [Note] InnoDB: Starting shutdown...

2017-04-12 00:26:43 8524 [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





WARNING: Found existing config file /usr/my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as /usr/my-new.cnf,

please compare it with your file and take the changes you need.





WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server





[root@master mysql]# netstat -nat    //检测端口是否启用

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address               Foreign Address             State      

tcp        0      0 0.0.0.0:22                 0.0.0.0:*                   LISTEN    //22号端口在监听状态

tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      

tcp        1      0 192.168.32.132:58955        219.93.37.75:80             CLOSE_WAIT 


[root@master mysql]# service mysql start
//启动mysql服务    

Starting MySQL.Logging to '/usr/share/mysql/mysqldata/master.err'.

.. SUCCESS! 

[root@master mysql]# rpm -ivh MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm     //安装mysql客户端

warning: MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 





Signature, key ID 5072e1f5: NOKEY

Preparing...                                                            





(100%########################################### [100%]

   1:MySQL-client                                                       (  





1%########################################### [100%]

然后将此目录下的my-default.cnf 复制到/etc/my.cnf

[root@master ~]# cp /usr/share/mysql/my-default.cnf  /etc/my.cnf        //将配置文件复制到/etc/my.cnf

打开/etc/my.cnf  并配置

[root@master ~]#
vim /etc/my.cnf

详细的配置项看:http://www.jb51.net/article/48082.htm

# 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.

重点配置是红色字体

[client]

port=3306

socket=/var/lib/mysql/mysql.sock



[mysqld]

character_set_server = utf8

port = 3306

datadir = /usr/share/mysql/mysqldata

socket =/var/lib/mysql/mysql.sock

explicit_defaults_for_timestamp=true

skip_name_resolve

log_bin_trust_function_creators = 1

event_scheduler=ON





lower_case_table_names=1

federated

# 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

max_connections = 1000

max_connect_errors = 10000





# These are commonly set, remove the # and set as required.

# basedir = .....

# datadir = .....

# port = .....

server_id =0

# 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



[mysql]

default-character-set = utf8

保存退出;

注意:若出现PID not found 的情况,可以注释掉配置文件中的default-character-set=utf8

然后关闭后台进程,重新启动mysql服务。

在安装mysql server的过程中,它会随机生成一个默认的密码,位置在: /root/.mysql_secret 





打开这个文件之后就可以看到随机的密码了。





[root@master mysql]# cat /root/.mysql_secret 

# The random password set for the root user at Tue Apr 11 01:35:47 2017 (local time): 





HwPKi2jYCHdPOdR1           //系统生成的密码





# The random password set for the root user at Wed Apr 12 00:26:39 2017 (local time): 





#####密码#####  //默认的密码



[root@master mysql]# mysql -uroot -p

Enter password: #####密码#####  //默认的密码

mysql> SET Password=PASSWORD('newpassword') //修改密码

mysql> FLUSH PRIVILEGES;

mysql> quit

[root@master mysql]# mysql -uroot -p

Enter password: <输入新设的密码newpassword>

rpm安装默认目录:

数据文件:/var/lib/mysql/

配置文件模板:/usr/share/mysql

mysql客户端工具目录:/usr/bin

日志目录:/var/log/

MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm安装详解的更多相关文章

  1. MySQL高可用方案-PXC(Percona XtraDB Cluster)环境部署详解

    MySQL高可用方案-PXC(Percona XtraDB Cluster)环境部署详解 Percona XtraDB Cluster简称PXC.Percona Xtradb Cluster的实现是在 ...

  2. MYSQL之数据库初识、安装详解、sql语句基本操作

    目录 MYSQL之数据库初识及安装详解 1.什么是数据库? 1.什么是数据?(data) 2.什么是数据库?(databases,简称DB) 2.为什要用数据库? 3.什么是数据库管理系统?(Data ...

  3. MySQL中的主键,外键有什么作用详解

    MySQL中的主键,外键有什么作用详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 学关系型数据库的同学,尤其在学习主键和外键时会产生一定的困惑.那么今天我们就把这个困惑连根拔起 ...

  4. mysql高可用架构之MHA,haproxy实现读写分离详解

    MySQL高可用架构之MHA 一.运维人员需要掌握的MySQL技术: 1.基本SQL语句 2.基本的管理[库表数据的管理    权限的管理] 3.容灾       保证数据不丢失. 二.工作中MySQ ...

  5. MySQL安装详解(V5.5 For Windows)

    前言 这几年一直在用MySQL,并且是Windows+.Net+MySQL的搭配,用MyISAM引擎支持过单表每天千万以上的数据递增,TB级的数据MySQL游刃有余.最近在做一个较大并发的项目,尝试了 ...

  6. MySQL数据库图文安装详解及相关问题

    (尊重劳动成果,转载请注明出处: http://blog.csdn.net/qq_25827845/article/details/53366444冷血之心的博客) 首先说明:安装目录中不能有中文和空 ...

  7. Mysql高手系列 - 第20篇:异常捕获及处理详解(实战经验)

    Mysql系列的目标是:通过这个系列从入门到全面掌握一个高级开发所需要的全部技能. 这是Mysql系列第20篇. 环境:mysql5.7.25,cmd命令中进行演示. 代码中被[]包含的表示可选,|符 ...

  8. Mysql编译安装详解

    wget http://mirrors.cnnic.cn/apache/httpd/mysql-5.5.20.tar.gz root@Mysql-server ~]# yum install -y c ...

  9. mysql多实例安装详解

    首先说明一个场景:我的电脑是ubuntu系统,之前apt-get自动安装过mysql.这也是出现错误最多的原因之一. 安装过程,其中充斥着各种错误: 6.mkdir mysql 7.groupadd  ...

随机推荐

  1. 1001 数组中和等于K的数对 1002 数塔取数问题 1003 阶乘后面0的数量 1004 n^n的末位数字 1009 数字1的数量

    1001 数组中和等于K的数对 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K ...

  2. MVC3/4/5/6 布局页及Razor语法及Route路由配置

    一.目录结构 二.Razor语法 代码块:@{},如:@{Html.Raw(“”);} @if(){} @switch(){} @for(){} @foreach(){} @while(){} @do ...

  3. yii2-swiftmailer入门

    1. 安装 用yii 2.0框架,默认会有这个扩展 composer require --prefer-dist yiisoft/yii2-swiftmailer 修改composer.json,re ...

  4. Python面试题之生成器/迭代器

    1.为什么要有生成器? 通过列表生成式,我们可以直接创建一个列表.但是,受到内存限制,列表容量肯定是有限的.而且,创建一个包含100万个元素的列表,不仅占用很大的存储空间,如果我们仅仅需要访问前面几个 ...

  5. pb9常见错误及含义

    1. by zero  发生被0除错误 2. Null object reference  空对象引用 3. Array boundary exceeded  数组越界 4. Enumerated v ...

  6. 【特效】给元素循环添加class

    经常会遇到给元素循环添加class的效果,例如下面这个图 每个模块的背景色和图标都不相同,但是呢,模块的数量又不确定,说不定有几十个,那我不能设计几十个图标吧,所以,可以做成每9个一循环,也就是第10 ...

  7. 深入浅出Diffie–Hellman

    一.作者 这个密钥交换方法,由惠特菲尔德·迪菲(Bailey Whitfield Diffie).马丁·赫尔曼(Martin Edward Hellman)于1976年发表. 二.说明 它是一种安全协 ...

  8. zabbix杂文二

    ps1:主要是一些遇到的问题,不一定对所有人都有用... PS2:安装前就一定要去看下官方文档 PS3:安装zabbix的时候会参照这上面的 http://blog.chinaunix.net/uid ...

  9. 墨卡托投影坐标系(Mercator Projection)原理及实现C代码

    墨卡托投影是一种"等角正切圆柱投影",荷兰地图学家墨卡托(Mercator)在1569年拟定:假设地球被围在一个中空的圆柱里,其赤道与圆柱相接触,然后再假想地球中心有一盏灯,把球面 ...

  10. 【转】ATA Secure Erase

    ATA Secure Erase     This procedure describes how to use the hdparm command to issue a Secure Erase  ...