linux安装mysql 5.6实时教程和配置

今天数据库服务器可以使用了,现在下一步就是安装mysql,决定mysql 版本为5.6.14

  1. 检查系统中是否已经安装过mysql。

    rpm -qa | grep mysql

    如下图:

  2. 如果存在,则需要删除。

    yum -y remove mysql*

  3. 继续检查一下是否还存在mysql

    rpm -qa | grep -i mysql

  4. 然后下一步就是下载rpm包了。需要下载:

    MySQL-client-5.6.15-1.el6.x86_64.rpm

    MySQL-devel-5.6.15-1.el6.x86_64.rpm

    MySQL-server-5.6.15-1.el6.x86_64.rpm

    逐一执行命令:

    wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-client-5.6.15-1.el6.x86_64.rpm

    wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-devel-5.6.15-1.el6.x86_64.rpm

    wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-server-5.6.15-1.el6.x86_64.rpm

  5. 接下来就是安装了分别依次执行:

    [[email protected] rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm

    Preparing...                ########################################### [100%]

    1:MySQL-server           ########################################### [100%]

    2015-03-06 08:16:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

    2015-03-06 08:16:03 28629 [Note] InnoDB: The InnoDB memory heap is disabled

    2015-03-06 08:16:03 28629 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

    2015-03-06 08:16:03 28629 [Note] InnoDB: Compressed tables use zlib 1.2.3

    2015-03-06 08:16:03 28629 [Note] InnoDB: Using Linux native AIO

    2015-03-06 08:16:03 28629 [Note] InnoDB: Using CPU crc32 instructions

    2015-03-06 08:16:03 28629 [Note] InnoDB: Initializing buffer pool, size = 128.0M

    2015-03-06 08:16:03 28629 [Note] InnoDB: Completed initialization of buffer pool

    2015-03-06 08:16:03 28629 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

    2015-03-06 08:16:03 28629 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

    2015-03-06 08:16:03 28629 [Note] InnoDB: Database physically writes the file full: wait...

    2015-03-06 08:16:03 28629 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

    2015-03-06 08:16:04 28629 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

    2015-03-06 08:16:06 28629 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

    2015-03-06 08:16:06 28629 [Warning] InnoDB: New log files created, LSN=45781

    2015-03-06 08:16:06 28629 [Note] InnoDB: Doublewrite buffer not found: creating new

    2015-03-06 08:16:06 28629 [Note] InnoDB: Doublewrite buffer created

    2015-03-06 08:16:06 28629 [Note] InnoDB: 128 rollback segment(s) are active.

    2015-03-06 08:16:06 28629 [Warning] InnoDB: Creating foreign key constraint system tables.

    2015-03-06 08:16:06 28629 [Note] InnoDB: Foreign key constraint system tables created

    2015-03-06 08:16:06 28629 [Note] InnoDB: Creating tablespace and datafile system tables.

    2015-03-06 08:16:06 28629 [Note] InnoDB: Tablespace and datafile system tables created.

    2015-03-06 08:16:06 28629 [Note] InnoDB: Waiting for purge to start

    2015-03-06 08:16:06 28629 [Note] InnoDB: 5.6.15 started; log sequence number 0

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

    2015-03-06 08:16:07 28629 [Note] Binlog end

    2015-03-06 08:16:07 28629 [Note] InnoDB: FTS optimize thread exiting.

    2015-03-06 08:16:07 28629 [Note] InnoDB: Starting shutdown...

    2015-03-06 08:16:08 28629 [Note] InnoDB: Shutdown completed; log sequence number 1625977

    2015-03-06 08:16:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

    2015-03-06 08:16:08 28652 [Note] InnoDB: The InnoDB memory heap is disabled

    2015-03-06 08:16:08 28652 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

    2015-03-06 08:16:08 28652 [Note] InnoDB: Compressed tables use zlib 1.2.3

    2015-03-06 08:16:08 28652 [Note] InnoDB: Using Linux native AIO

    2015-03-06 08:16:08 28652 [Note] InnoDB: Using CPU crc32 instructions

    2015-03-06 08:16:08 28652 [Note] InnoDB: Initializing buffer pool, size = 128.0M

    2015-03-06 08:16:08 28652 [Note] InnoDB: Completed initialization of buffer pool

    2015-03-06 08:16:08 28652 [Note] InnoDB: Highest supported file format is Barracuda.

    2015-03-06 08:16:08 28652 [Note] InnoDB: 128 rollback segment(s) are active.

    2015-03-06 08:16:08 28652 [Note] InnoDB: Waiting for purge to start

    2015-03-06 08:16:08 28652 [Note] InnoDB: 5.6.15 started; log sequence number 1625977

    2015-03-06 08:16:08 28652 [Note] Binlog end

    2015-03-06 08:16:08 28652 [Note] InnoDB: FTS optimize thread exiting.

    2015-03-06 08:16:08 28652 [Note] InnoDB: Starting shutdown...

    2015-03-06 08:16:10 28652 [Note] InnoDB: Shutdown completed; log sequence number 1625987

    [[email protected] rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm

    Preparing...                ########################################### [100%]

    1:MySQL-devel            ########################################### [100%]

    [[email protected] rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm

    Preparing...                ########################################### [100%]

    1:MySQL-client           ########################################### [100%]

    修改配置文件位置。

    [[email protected] rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

  6. 初始化MySQL及设置密码

    cp /usr/share/mysql/my-default.cnf /etc/my.cnf

    /usr/bin/mysql_install_db

    cat /root/.mysql_secret

    记录最后的密码

    mysql -p ---输入记录的密码,即可登录mysql。

    set password for ‘root‘@‘localhost‘ =password(‘新密码‘);

    flush privileges;

    exit

  7. 设置自启动

    chkconfig
    mysql on

  8. MySQL的默认安装位置

    1 /var/lib/mysql/               #数据库目录
    2 /usr/share/mysql              #配置文件目录
    3 /usr/bin                     #相关命令目录
    4 /etc/init.d/mysql              #启动脚本
  9. 修改字符集和数据存放目录

    原来配置文件:

    更改之后为:

    # 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

    default-character-set=utf8

    [mysqld]

    # 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 = /mnt/data/mysql

    port = 3306

    # server_id = .....

    # socket = .....

    lower_case_table_names=1

    max_connections=1000

    collation_server = utf8_general_ci

    character_set_server = utf8

    # default-character-set=utf8

    # init_connect=‘SET NAMES utf8‘

    # 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

    注意标红的。

    然后就是修改数据库的数据目录:

    vi /etc/init.d/mysql

  10. 重启数据库:

    service mysql restart

  11. 大功告成。

时间: 2024-11-08 21:58:00

linux安装mysql 5.6实时教程和配置的相关文章

Linux安装mysql教程

Linux安装mysql教程 1,设置安装路径 安装文件下载目录:/data/softwareMysql目录安装位置:/usr/local/mysql数据库保存位置:/data/mysql日志保存位置:/data/log/mysql 2,下载Mysql 在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载: 执行如下命名:#mkdir /data/software#cd /data/software --下载安装包 --建议:在wi

Linux安装mysql

——@梁WP 摘要:Linux安装mysql. 一.下载mysql 1.在百度搜索mysql,看到其中有一条结果是带有MySQL Downloads字样的,点击进入mysql的官网. 2.进入mysql官网之后,在下面能见到MySQL Community Edition (GPL),点击下面的链接,就会进入下载列表. 3.在下载列表找到MySQL Community Server,点击下面的链接,会进入产品选择页面. 4.选择对应的操作系统,然后选择合适的版本(.gz格式),截图选了Linux 

linux安装mysql、tomcat和jdk1.7、Android Studio

linux安装mysql.tomcat和jdk. 一.安装mysql $ sudo apt-get install mysql-server 安装mysql 二.安装JDK 下载jdk 到达/usr/local $ sudo mkdir java 建立一个java文件夹 (注:sudo 请求root权限 ) $ sudo mv jdk1.7.0_67 /usr/local/java 将解压的文件移到刚刚建好的文件夹 $ sudo vim /etc/profile 可能vim编辑器没有安装 因此执

Linux 安装MySql启动Can't locate Data/Dumper.pm in @INC

通过RPM包CentOS7 安装MySQL的时候提示“Can't locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/bin/mysql_install_db l

linux安装MySQL记录

目录 linux安装MySQL记录 1. 在根目录下创建文件夹/software和数据库数据文件/data/mysql 2. 从官网下载相应的MySQL版本 3. 解压并移动到/software目录下 4. 创建mysql用户组和mysql用户 5. 关联myql用户到mysql用户组中 6. 更改文件夹的权限 7. 安装libaio依赖包 8. 初始化mysql命令 9. 修改Mysql配置文件 10. 启动MySQL服务 11. 登录mysql 12. 修改mysql的登录密码 13. My

linux安装mysql教程【转】

Mysql5.7 Linux安装教程 1系统约定安装文件下载目录:/data/softwareMysql目录安装位置:/usr/local/mysql数据库保存位置:/data/mysql日志保存位置:/data/log/mysql 2下载mysql在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载: 执行如下命名:#mkdir /data/software#cd /data/software --下载安装包 --建议:在wind

linux 安装mysql数据库——yum安装法

mysql数据库有多种安装方式,本文只介绍在Linux服务器上最实用.最快捷的mysql server安装方法.一.Linux服务器yum安装(CentOS6.3 64位)所有在服务器上执行的命令,都在 # 后面1.命令安装mysql# yum install mysql mysql-server mysql-devel -y最后提示 Complete!  表示安装成功 2.查看是否生成了mysqld服务, 并设置随机启动# chkconfig --list |grep mysql 数字代码服务

linux 安装mysql

查看 rpm -qa|grep mysql 或者 rpm -qa | grep -i mysql 如果有就卸载 rpm -e mysql-libs --nodeps 或者 yum remove mysql* 命令卸载mysql及相关组件 上传 MySQL-client-5.6.35-1.el6.x86_64.rpm MySQL-devel-5.6.35-1.el6.x86_64.rpm MySQL-server-5.6.35-1.el6.x86_64.rpm 安装 # rpm -ivh MySQ

【mysql学习】linux安装mysql

1.rpm bundel包下载到 /usr/local/src中: [[email protected] src]# lsmysql-5.7.11-1.el6.x86_64.rpm-bundle.tar 2解压缩bundle包 [[email protected] src]# tar xf mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar  [[email protected] src]# ls mysql-5.7.11-1.el6.x86_64.rpm-bund