Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz

 更新时间:2016年9月18日 09:00  点击:1818

从官网下载mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz

创建mysql用户

[root@Master home]# useradd mysql
[root@Master data]# echo 'mysql'|passwd --stdin mysql

更改用户 mysql 的密码 。

passwd: 所有的身份验证令牌已经成功更新。

创建mysql用户的原因

不用mysql用户会出现一下错误,尝试了很多次,添加mysql用户安装成功

*当然很多时候我们已经创建好别的用户,来完成日常的操作如果不创建mysql用户,修改mysql/bin目录下的mysqld_safe文件; //亲测成功

具体步骤:

[root@Master bin]# vim mysqld_safe
user='mysql' 修改为 user='hadoop' //自己的用户 后边步骤基本相同*
[root@Slave1 data]# service mysql start
Starting MySQL...... ERROR! The server quit without updating PID file (/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pid).
[root@Master data]#vim Slave1.Hadoop.err //查看日志文件
160830 15:56:44 mysqld_safe Starting mysqld daemon with databases from /home/hadoop/ruanJian/mysql/data
2016-08-30 15:56:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-30 15:56:49 1990 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
2016-08-30 15:56:49 1990 [ERROR] Aborting
2016-08-30 15:56:49 1990 [Note] Binlog end
2016-08-30 15:56:49 1990 [Note] /home/hadoop/ruanJian/mysql/bin/mysqld: Shutdown complete
160830 15:56:49 mysqld_safe mysqld from pid file /home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pid ended

在mysql用户下创建data目录并解压

[root@Master data]# tar -zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
[root@Master data]# mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql //重命名

设置权限

[root@Master data]# chown -R mysql:mysql mysql

切换用户并进入mysql/scripts 目录

[root@Master data]# su mysql
[mysql@Master data]$ cd mysql/scripts/
[mysql@Master scripts]$

安装(目录根据自己的mysql解压目录自行设置)

[mysql@Master scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/data/mysql --datadir=/home/mysql/data/mysql/data

输出信息

Installing MySQL system tables...2016-08-30 19:55:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)
2016-08-30 19:55:42 1354 [Note] InnoDB: The InnoDB memory heap is disabled
2016-08-30 19:55:42 1354 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-08-30 19:55:42 1354 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-08-30 19:55:42 1354 [Note] InnoDB: Using Linux native AIO
2016-08-30 19:55:42 1354 [Note] InnoDB: Not using CPU crc32 instructions
2016-08-30 19:55:42 1354 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-08-30 19:55:42 1354 [Note] InnoDB: Completed initialization of buffer pool
2016-08-30 19:55:42 1354 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-08-30 19:55:42 1354 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-08-30 19:55:42 1354 [Note] InnoDB: Database physically writes the file full: wait...
2016-08-30 19:55:42 1354 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-08-30 19:55:43 1354 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-08-30 19:55:44 1354 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-08-30 19:55:44 1354 [Warning] InnoDB: New log files created, LSN=45781
2016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer created
2016-08-30 19:55:44 1354 [Note] InnoDB: 128 rollback segment(s) are active.
2016-08-30 19:55:44 1354 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-08-30 19:55:44 1354 [Note] InnoDB: Foreign key constraint system tables created
2016-08-30 19:55:44 1354 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-08-30 19:55:44 1354 [Note] InnoDB: Tablespace and datafile system tables created.
2016-08-30 19:55:44 1354 [Note] InnoDB: Waiting for purge to start
2016-08-30 19:55:44 1354 [Note] InnoDB: 5.6.12 started; log sequence number 0
2016-08-30 19:55:44 1354 [Note] Binlog end
2016-08-30 19:55:44 1354 [Note] InnoDB: FTS optimize thread exiting.
2016-08-30 19:55:44 1354 [Note] InnoDB: Starting shutdown...
2016-08-30 19:55:46 1354 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2016-08-30 19:55:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)
2016-08-30 19:55:46 1377 [Note] InnoDB: The InnoDB memory heap is disabled
2016-08-30 19:55:46 1377 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-08-30 19:55:46 1377 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-08-30 19:55:46 1377 [Note] InnoDB: Using Linux native AIO
2016-08-30 19:55:46 1377 [Note] InnoDB: Not using CPU crc32 instructions
2016-08-30 19:55:46 1377 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-08-30 19:55:46 1377 [Note] InnoDB: Completed initialization of buffer pool
2016-08-30 19:55:46 1377 [Note] InnoDB: Highest supported file format is Barracuda.
2016-08-30 19:55:46 1377 [Note] InnoDB: 128 rollback segment(s) are active.
2016-08-30 19:55:46 1377 [Note] InnoDB: Waiting for purge to start
2016-08-30 19:55:46 1377 [Note] InnoDB: 5.6.12 started; log sequence number 1625977
2016-08-30 19:55:46 1377 [Note] Binlog end
2016-08-30 19:55:46 1377 [Note] InnoDB: FTS optimize thread exiting.
2016-08-30 19:55:46 1377 [Note] InnoDB: Starting shutdown...
2016-08-30 19:55:48 1377 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/home/mysql/data/mysql/bin/mysqladmin -u root password 'new-password'
/home/mysql/data/mysql/bin/mysqladmin -u root -h Master.Hadoop password 'new-password'

Alternatively you can run:

/home/mysql/data/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /home/mysql/data/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
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 /home/mysql/data/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
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

配置文件

[mysql@Master scripts]$ cd ../support-files/
[root@Master support-files]# cp my-default.cnf /etc/my.cnf
[root@Master support-files]# cp mysql.server /etc/init.d/mysql
[root@Master support-files]# vim /etc/init.d/mysql //修改mysql文件

添加以下两行

basedir=/home/mysql/data/mysql
datadir=/home/mysql/data/mysql/data

配置环境变量

[root@Master support-files]# vim /etc/profile
#set mysql environment
export MYSQL_HOME=/home/mysql/data/mysql
export PATH=$MYSQL_HOME/bin:$PATH

配置mysql服务开机自动启动

[root@Master bin]# chkconfig --add mysql //添加mysql
[root@Master bin]# chkconfig mysql on //设置开机启动

启动mysql

[root@Master support-files]# service mysql start
env: /etc/init.d/mysql: 权限不够 //如果出现这个提示 执行以下命令重新启动
[root@Master support-files]# chmod a+wrx /etc/init.d/mysql
[root@Master support-files]# service mysql start
Starting MySQL.. SUCCESS! //启动成功

设置root登录密码

[root@Master ~]# cd /home/mysql/data/mysql/bin/ //进去mysql的bin目录
[root@Master bin]# ./mysqladmin -u root password 'password' //'password' 为自己设置的密码引号非必须
[root@Master bin]# ./mysqladmin -u root password mysql
[root@Master bin]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.12 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

以上所述是小编给大家介绍的Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

[!--infotagslink--]

相关文章

  • MySQL性能监控软件Nagios的安装及配置教程

    这篇文章主要介绍了MySQL性能监控软件Nagios的安装及配置教程,这里以CentOS操作系统为环境进行演示,需要的朋友可以参考下...2015-12-14
  • 详解Mysql中的JSON系列操作函数

    新版 Mysql 中加入了对 JSON Document 的支持,可以创建 JSON 类型的字段,并有一套函数支持对JSON的查询、修改等操作,下面就实际体验一下...2016-08-23
  • 深入研究mysql中的varchar和limit(容易被忽略的知识)

    为什么标题要起这个名字呢?commen sence指的是那些大家都应该知道的事情,但往往大家又会会略这些东西,或者对这些东西一知半解,今天我总结下自己在mysql中遇到的一些commen sense类型的问题。 ...2015-03-15
  • MySQL 字符串拆分操作(含分隔符的字符串截取)

    这篇文章主要介绍了MySQL 字符串拆分操作(含分隔符的字符串截取),具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-02-22
  • mysql的3种分表方案

    一、先说一下为什么要分表:当一张的数据达到几百万时,你查询一次所花的时间会变多,如果有联合查询的话,有可能会死在那儿了。分表的目的就在于此,减小数据库的负担,缩短查询时间。根据个人经验,mysql执行一个sql的过程如下:1...2014-05-31
  • Windows服务器MySQL中文乱码的解决方法

    我们自己鼓捣mysql时,总免不了会遇到这个问题:插入中文字符出现乱码,虽然这是运维先给配好的环境,但是在自己机子上玩的时候咧,总得知道个一二吧,不然以后如何优雅的吹牛B。...2015-03-15
  • Centos5.5中安装Mysql5.5过程分享

    这几天在centos下装mysql,这里记录一下安装的过程,方便以后查阅Mysql5.5.37安装需要cmake,5.6版本开始都需要cmake来编译,5.5以后的版本应该也要装这个。安装cmake复制代码 代码如下: [root@local ~]# wget http://www.cm...2015-03-15
  • 用VirtualBox构建MySQL测试环境

    宿主机使用网线的时候,客户机在Bridged Adapter模式下,使用Atheros AR8131 PCI-E Gigabit Ethernet Controller上网没问题。 宿主机使用无线的时候,客户机在Bridged Adapter模式下,使用可选项里唯一一个WIFI选项,Microsoft Virtual Wifi Miniport Adapter也无法上网,故弃之。...2013-09-19
  • 忘记MYSQL密码的6种常用解决方法总结

    首先要声明一点,大部分情况下,修改MySQL密码是需要有mysql里的root权限的...2013-09-11
  • MySQL数据库备份还原方法

    MySQL命令行导出数据库: 1,进入MySQL目录下的bin文件夹:cd MySQL中到bin文件夹的目录 如我输入的命令行:cd C:/Program Files/MySQL/MySQL Server 4.1/bin (或者直接将windows的环境变量path中添加该目录) ...2013-09-26
  • Mysql命令大全(详细篇)

    一、连接Mysql格式: mysql -h主机地址 -u用户名 -p用户密码1、连接到本机上的MYSQL。首先打开DOS窗口,然后进入目录mysql/bin,再键入命令mysql -u root -p,回车后提示你输密码.注意用户名前可以有空格也可以没有空格,但是密...2015-11-08
  • Navicat for MySQL 11注册码\激活码汇总

    Navicat for MySQL注册码用来激活 Navicat for MySQL 软件,只要拥有 Navicat 注册码就能激活相应的 Navicat 产品。这篇文章主要介绍了Navicat for MySQL 11注册码\激活码汇总,需要的朋友可以参考下...2020-11-23
  • mysql IS NULL使用索引案例讲解

    这篇文章主要介绍了mysql IS NULL使用索引案例讲解,本篇文章通过简要的案例,讲解了该项技术的了解与使用,以下就是详细内容,需要的朋友可以参考下...2021-08-14
  • node.js如何操作MySQL数据库

    这篇文章主要介绍了node.js如何操作MySQL数据库,帮助大家更好的进行web开发,感兴趣的朋友可以了解下...2020-10-29
  • 基于PostgreSQL和mysql数据类型对比兼容

    这篇文章主要介绍了基于PostgreSQL和mysql数据类型对比兼容,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-12-25
  • RHEL6.5编译安装MySQL5.6.26教程

    一、准备编译环境,安装所需依赖包yum groupinstall 'Development' -y yum install openssl openssl-devel zlib zlib-devel -y yum install readline-devel pcre-devel ncurses-devel bison-devel cmake -y二、编译安...2015-10-21
  • Mysql中 show table status 获取表信息的方法

    这篇文章主要介绍了Mysql中 show table status 获取表信息的方法的相关资料,需要的朋友可以参考下...2016-03-12
  • 20分钟MySQL基础入门

    这篇文章主要为大家分享了20分钟MySQL基础入门教程,快速掌握MySQL基础知识,真正了解MySQL,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2016-12-02
  • mongodb与mysql命令详细对比

    传统的关系数据库一般由数据库(database)、表(table)、记录(record)三个层次概念组成,MongoDB是由数据库(database)、集合(collection)、文档对象(document)三个层次组成。MongoDB对于关系型数据库里的表,但是集合中没有列、行和关...2013-09-11
  • Delphi远程连接Mysql的实现方法

    这篇文章主要介绍了Delphi远程连接Mysql的实现方法,需要的朋友可以参考下...2020-06-30