linux5.6怎么linux安装mysql5.6.37

Linux上安装MySQL5.6
OS & MySQL的版本和配置:
MySQL Version: 5.6.19
Version: Linux
2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT
i686 i386 GNU/Linux
一,下载MySQL安装软件,请到 去找DATABASE DOWNLOAD,下载MySQL需要注册一个账号。我下载的版本如下:
下载后解压就是以下的8个文件 :
二, 在Linux上安装MySQL(一个服务器程序和一个客户端程序)
[root@vmoel5u4 _installer]# ll
total 115896
-rw-r--r-- 1 root root
May 8 2014 MySQL-client-advanced-5.6.19-1.rhel5.i386.rpm
-rw-r--r-- 1 root root
May 8 2014 MySQL-server-advanced-5.6.19-1.rhel5.i386.rpm
--安装Server端:
[root@vmoel5u4 mysql_installer]# rpm -ivh MySQL-server-advanced-5.6.19-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server-advanced ########################################### [100%]
00:34:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
00:34:49 16251 [Note] InnoDB: Using mutexes to ref count buffer pool pages
00:34:49 16251 [Note] InnoDB: The InnoDB memory heap is disabled
00:34:49 16251 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
00:34:49 16251 [Note] InnoDB: Compressed tables use zlib 1.2.3
00:34:49 16251 [Note] InnoDB: Using Linux native AIO
00:34:49 16251 [Note] InnoDB: Not using CPU crc32 instructions
00:34:49 16251 [Note] InnoDB: Initializing buffer pool, size = 128.0M
00:34:49 16251 [Note] InnoDB: Completed initialization of buffer pool
00:34:49 16251 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
00:34:49 16251 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
00:34:49 16251 [Note] InnoDB: Database physically writes the file full: wait...
00:34:49 16251 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
00:34:50 16251 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
00:34:50 16251 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
00:34:50 16251 [Warning] InnoDB: New log files created, LSN=45781
00:34:50 16251 [Note] InnoDB: Doublewrite buffer not found: creating new
00:34:50 16251 [Note] InnoDB: Doublewrite buffer created
00:34:50 16251 [Note] InnoDB: 128 rollback segment(s) are active.
00:34:50 16251 [Warning] InnoDB: Creating foreign key constraint system tables.
00:34:50 16251 [Note] InnoDB: Foreign key constraint system tables created
00:34:50 16251 [Note] InnoDB: Creating tablespace and datafile system tables.
00:34:50 16251 [Note] InnoDB: Tablespace and datafile system tables created.
00:34:50 16251 [Note] InnoDB: Waiting for purge to start
00:34:50 16251 [Note] InnoDB: 5.6.19 log sequence number 0
00:34:50 16251 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
00:34:50 16251 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
00:34:51 16251 [Note] Binlog end
00:34:51 16251 [Note] InnoDB: FTS optimize thread exiting.
00:34:51 16251 [Note] InnoDB: Starting shutdown...
00:34:53 16251 [Note] InnoDB: S log sequence number 1625977
00:34:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
00:34:53 16282 [Note] InnoDB: Using mutexes to ref count buffer pool pages
00:34:53 16282 [Note] InnoDB: The InnoDB memory heap is disabled
00:34:53 16282 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
00:34:53 16282 [Note] InnoDB: Compressed tables use zlib 1.2.3
00:34:53 16282 [Note] InnoDB: Using Linux native AIO
00:34:53 16282 [Note] InnoDB: Not using CPU crc32 instructions
00:34:53 16282 [Note] InnoDB: Initializing buffer pool, size = 128.0M
00:34:53 16282 [Note] InnoDB: Completed initialization of buffer pool
00:34:53 16282 [Note] InnoDB: Highest supported file format is Barracuda.
00:34:53 16282 [Note] InnoDB: 128 rollback segment(s) are active.
00:34:53 16282 [Note] InnoDB: Waiting for purge to start
00:34:53 16282 [Note] InnoDB: 5.6.19 log sequence number 1625977
00:34:53 16282 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
00:34:53 16282 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
00:34:53 16282 [Note] Binlog end
00:34:53 16282 [Note] InnoDB: FTS optimize thread exiting.
00:34:53 16282 [Note] InnoDB: Starting shutdown...
00:34:55 16282 [Note] InnoDB: S 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.
/* 上面的红色的大概意思如下:
为MySQL的的root的用户生成了一个随机的秘密,请到/root/.mysql_secret里去找密码。
当你第一次登陆时必须修改密码,同时匿名帐号已经被删除掉了。
除此之外,你可以执行:
/usr/bin/mysql_secure_installation
他可以给你一些移除test 数据库的选项。
强烈推荐在生产服务器上做此操作。
See the manual for more instructions.
Please report any problems at /
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at
New default config file was created as /f and
will be used by default by the server when you start it.
You may edit this file to change server settings
--安装Client端:
[root@vmoel5u4 mysql_installer]# rpm -ivh MySQL-client-advanced-5.6.19-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client-advanced ########################################### [100%]
三,MySQL 数据库的配置
1,启动MySQL服务
[root@vmoel5u4 mysql_installer]# cd /etc/rc.d/init.d
[root@vmoel5u4 init.d]# service mysql start
Starting MySQL.......... [ OK ]
2,修改MySQL数据库root用户的初始密码,先查下初始密码
[root@vmoel5u4 mysql_installer]# vi /root/.mysql_secret
# The random password set for the root user at Sun Nov 18 00:34:51 2012 (local time): kX65UtYvovXN9VOV
从上面可以初始密码是:kX65UtYvovXN9VOV
[root@vmoel5u4 init.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. C or \g.
Your MySQL connection id is 15
Server version: 5.6.19-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) ,
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
Type '' or '\h' for help. Type '\c' to clear the current input statement.
/*修改密码为123456*/
mysql& update user set password=PASSWORD(';) where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
/*刷新权限表*/
Query OK, 0 rows affected (0.00 sec)
3,用新密码123456登陆MySQL
[root@vmoel5u4 init.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. C or \g.
Your MySQL connection id is 16
Server version: 5.6.19-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) , 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
Type '' or '\h' for help. Type '\c' to clear the current input statement.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql& select Host,User,P
+-----------+------+-------------------------------------------+
| Host | User | Password |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB05EE4568DDA7DC67ED2CA2AD9 |
| 127.0.0.1 | root | *6BB05EE4568DDA7DC67ED2CA2AD9 |
| ::1 | root | *6BB05EE4568DDA7DC67ED2CA2AD9 |
+-----------+------+-------------------------------------------+
3 rows in set (0.00 sec)
4, 创建新的表test,并插入测试数据
mysql& create table test(id int);
Query OK, 0 rows affected (0.05 sec)
mysql& insert into test(id) values(1);
Query OK, 1 row affected (0.05 sec)
mysql& insert into test(id) values(2);
Query OK, 1 row affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
mysql& select *
2 rows in set (0.02 sec)系统环境:
CentOS 6.5 / 7.0 x86_64
Fedora 20 x86_64
是 MySQL 的衍生版,专注于 Linux/BSD 下 MySQL 数据库服务器的改进,
在功能和性能上较 MySQL 有着。
Percona Server 的编译、配置和使用与 MySQL 完全一致,你完全可以把它当成是 MySQL 来使用。
下载 Percona Server 源码包
# wget /downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.17-66.0.tar.gz
或 MySQL 源码包
# wget /Downloads/MySQL-5.6/mysql-5.6.19.tar.gz
# yum install gcc-c++ make cmake bison bison-devel ncurses-devel libaio-devel perl
对于 Fedora 20 和 CentOS 7 需要另外安装一个 perl-Data-Dumper 包:
# yum install
perl-Data-Dumper
创建 MySQL 用户
# groupadd mysql
# useradd -g mysql -s /sbin/nologin -M mysql
创建日志目录和 SOCK 目录并更改权限
# mkdir /var/log/mysql56
# chown -R mysql:mysql /var/log/mysql56/
# tar zxf percona-server-5.6.17-66.0.tar.gz -C /usr/local/src/
# cd /usr/local/src/percona-server-5.6.17-66.0/
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 \
-DSYSCONFDIR=/usr/local/mysql56/etc \
-DMYSQL_DATADIR=/var/lib/mysql56 \
-DMYSQL_UNIX_ADDR=/var/run/mysql56/mysqld.sock \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1
DENABLED_LOCAL_INFILE:允许导入文件到数据库,以加快数据导入速度,
使用 SQL 语句: LOAD DATA LOCAL INFILE 数据文件 INTO TABLE 表名。
DWITH_READLINE:绑定
的终端快捷键及历史记录功能。但是安装完后是不是仍然找不着 readline 的感觉,
因为 ,同样 。
点击查看 。
如果编译失败,清理源码目录下的 CMakeCache.txt 文件,重新编译即可。
# make -j8
# make install
初始化数据库
切换到 MySQL 安装目录:
# cd /usr/local/mysql56/
以 mysql 用户的身份创建 /var/lib/mysql56 datadir 目录,并写入初始化数据库信息:
# ./scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql56
拷贝服务文件到 /etc/init.d/mysql56,mysql56 这个文件名也是服务名,可以任意更改,
为了统一我们使用 mysql56 作为文件名:
# cp support-files/mysql.server /etc/init.d/mysql56
配置 my.cnf
# vi /usr/local/mysql56/f
datadir=/var/lib/mysql56
socket=/var/run/mysql56/mysqld.sock
skip-name-resolve
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysql56/mysqld-err.log
#pid-file=/var/lib/mysql56/aboutc.pid
请注意文件路径。
启动 MySQL 服务
# service mysql56 start
Starting MySQL (Percona Server).. SUCCESS!
更改 root 用户密码
# ./bin/mysqladmin -u root password 'new-password'
删除登录用户密码为空的数据
# ./bin/mysql -uroot -p
Enter password:
mysql& delete from mysql.user where password = '';
Query OK, 5 rows affected (0.51 sec)
mysql& select user,host,password from mysql.
+------+-----------+-------------------------------------------+
| user | host
| password
+------+-----------+-------------------------------------------+
| root | localhost | *9F6F2XXXX40B6DF5D2A5F762E1CF33782CA1ABXX |
+------+-----------+-------------------------------------------+
1 row in set (0.01 sec)
到此 MySQL(Percona Server) 编译安装完毕,你同样可以选择使用 ,
关于不同的内存大小你也可以选择相应的 ,使你的服务器资源可以平衡,提供更好的性能。
如果启动 MySQL 服务时出现:Starting MySQL. ERROR! The server quit without updating PID file 错误,
请检查 <f 中 log-error 配置的路径及权限。
如果访问数据库时出现:Can't connect to local MySQL server through socket 'xxx.sock' 错误,
请检查 <f 中 socket 配置的路径及权限。
转载请注明出处。本文地址:
文中 mysql 的下载地址貌似不能下载了。
新的地址: wget /downloads/Percona-Server-5.6/Percona-Server-5.6.22-72.0/binary/tarball/Percona-Server-5.6.22-rel72.0-738.TokuDB.Linux.x86_64.tar.gz
上面的地址下载后没有 CMakeCache.txt 文件。
另一个新的可用的 wget /downloads/Percona-Server-5.6/Percona-Server-5.6.22-72.0/source/tarball/percona-server-5.6.22-72.0.tar.gz
LINUX热门文章
? 热门标签
? 本文目录好久没玩linux,由于项目需要部署新的linux开发环境,包括安装jdk,tomcat,redis,mysql,趁着有时间,赶紧部署好。jdk,tomcat,redis很快就部署好了,唯独mysql让我折腾了一阵。先安装了我之前就安装过的源码版mysql-5.6.4,后又安装了最新的rpm版mysql-5.6.21。还不过瘾,又下载安装了最新的tar.gz版mysql-5.6.21。就这样捣鼓着,得出一丢丢经验,留下记录,与众分享。
以下是凭自己记忆写的,难免有误,请理解!
环境:centos 6.4 x64
先下载mysql安装包
选择 linux - Generic
下载完毕后,得到安装包 mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz
此包不再需要make编译源代码(真是扛扛的),之前的mysql-5.6.4.tar.gz包是源码包,需要先cmake,再make & make install
上传到centos6.4的/software目录下(可以改为你需要的目录,这里只是演示)
ssh登录到centos6.4,开始执行以下命令
1.解压tar包
cd /software
tar -xzvf&mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz
mv&mysql-5.6.21-linux-glibc2.5-x86_64&mysql-5.6.21
2.添加用户与组
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql:mysql mysql-5.6.21
3.安装数据库
cd&mysql-5.6.21/scripts
./mysql_install_db --user=mysql --basedir=/software/mysql-5.6.21&--datadir=/software/mysql-5.6.21/data
4.配置文件
cd&/software/mysql-5.6.21/support-files
cp mysql.server /etc/init.d/mysql
vim&/etc/init.d/mysql & & & & &#若mysql的安装目录是/usr/local/mysql,则可省略此步
修改文件中的两个变更&#20540;
basedir=/software/mysql-5.6.21
datadir=/software/mysql-5.6.21/data
5.配置环境变量
vim /etc/profile
export MYSQL_HOME=&/software/mysql-5.6.21&
export PATH=&$PATH:$MYSQL_HOME/bin&
. /etc/profile
6.添加自启动服务
chkconfig --add mysql
chkconfig mysql on
7.启动mysql
service mysql start
8.登录mysql及改密码与配置远程访问
mysqladmin -u root password 'your_password' & &&#修改root用户密码
mysql -u root&-p & &&#登录mysql,需要输入密码
mysql&GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION; & &&#允许root用户远程访问
mysql&FLUSH PRIVILEGES; & &&#刷新权限
mysql&exit
--------------------------- 添加
又装了一次此版本的mysql,发现root用户不能登录,提示没权限。使用mysqld_safe 登进去,发现user表居然是空的,没有一个用户,郁闷。
于是从其它地方导出了一份user表的sql语句,手动插入了一个用户,再登录就可以了。
忘记root密码后,如何找回密码
cd $MYSQL_HOME
./bin/mysqld_safe --basedir=/data/mysql-5.6.21 --datadir=/data/mysql-5.6.21/data --skip-grant-tables &
mysql -u root mysql
UPDATE user SET password=PASSWORD(&new_password&) WHERE user='root';
FLUSH PRIVILEGES;
本文已收录于以下专栏:
相关文章推荐
准备&#160;
0.&#160;获取 mysql-5.5.15-linux2.6-i686.tar.gz 二进制安装文件&#160;
mysql 官网下载页面选择
Linux-Generic 下的 Linux - Generi...
1、下载mysql.tar.gz
官网下载mysql安装包,Linux-Generic 64位(根据系统选择64or32)
也可以用wget命令下载
64位下载链接: http://120.52.72...
由于利用 yum install mysql 下载安装发生错误,所以只能下载tar.gz包或者rpm包进行安装,这里我下载的是tar.gz包
下载完成后先解压:
tar zvxf mysql-...
最近新换了工作,新的公司项目中服务器用的是Linux,虽然以前有自学过,但是都没有用到正式的环境中,为了能更快的融入新项目、新环境,就利用空闲时间自己鼓捣公司里面的东西,首先就从最基本的如何安装数据库...
一、&#160;&#160; linux安装mysql服务分两种安装方法:
①源码安装,优点是安装包比较小,只有十多M,缺点是安装依赖的库多,安装编译时间长,安装步骤复杂容易出错;
②使用官方编译好的二进制文件安装,优点...
他的最新文章
讲师:王哲涵
讲师:王渊命
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)linux下安装mysql5.6-个人心得_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
linux下安装mysql5.6-个人心得
&&自己安装mysql的一点经验
阅读已结束,下载文档到电脑
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,方便使用
还剩22页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢查看:1669|回复:6
[img]file:///C:\Users\admin\AppData\Roaming\Tencent\Users\\QQ\WinTemp\RichOle\7YGD[2~9QAF9G~~[]5%SEG7.png[/img]
(37.19 KB)
linux什么版本
rpm -qa |grep -i mysql看看数据库安装没,server,client两个包安完即可登录,我今天安得rhel7的,没见你说还非得要初始化的。
引用:原帖由 麦麦啼 于
20:37 发表
linux什么版本
rpm -qa |grep -i mysql看看数据库安装没,server,client两个包安完即可登录,我今天安得rhel7的,没见你说还非得要初始化的。 linux是rhel5,安装mysql-5.6.26,用的是cmake-3.4.0编译源码,跳过初始化那一步mysql不能启动Starting MySQL......The server quit without updating PID file (/home/mysql/mysqldb/gdfwdb01.pid).& && && && && && && && && && && && && && &[FAILED]
用find查找下mysql_print_defaults文件,编译安装时basedir指定下试试,现在安装mysql好像都用cmake去编译了
引用:原帖由 运维菜鸟 于
09:35 发表
用find查找下mysql_print_defaults文件,编译安装时basedir指定下试试,现在安装mysql好像都用cmake去编译了 在安装目录下有mysql_print_defaults文件,很奇怪为什么找不到
官网有现成的yum原,lz以你现在的水平建议还是别编译了
编译过程一定得自己体会过才行,在网上找个相关的攻略。你是不是cmake .的时候报错了,记得最新版本的mysql是要boost支持的

我要回帖

更多关于 linux下怎么安装mysql 的文章

 

随机推荐