mysql安装rpm方式
mysql中rpm方式安装的详解
mysql中rpm⽅式安装的详解查看安装以及卸载# 查看rpm -qa | grep mysql# 卸载yum -y remove mysql-libs-5.1.66-2.el6_3.x86_641.centos7需要先卸载mariadb查看命令rpm -qa | grep mariadb安装包资源地址# 下载资源名称mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar解压资源tar -xvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar获取rpm包mysql-community-common-5.7.19-1.el6.x86_64.rpmmysql-community-client-5.7.19-1.el6.x86_64.rpmmysql-community-server-5.7.19-1.el6.x86_64.rpmmysql-community-libs-5.7.19-1.el6.x86_64.rpm安装# 安装顺序# common --> libs --> clients --> server# 安装命令rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm mysql-community-libs-5.7.19-1.el6.x86_64.rpm mysql-community-client-5.7.19-1.el6.x86_64.rpm mysql-community-server-5.7.19-1.el6.x86_64.rpm 可能需要依赖包libaio安装命令yum -y install libaio初始化mysqld --initialize --user=mysql启动service mysqld start登录# 查看初始密码cat /var/logs/mysql.log#或者grep 'password' /var/logs/mysql.log -n -B 5# 登陆mysql -uroot -p'123456'# 修改初始密码set PASSWORD=PASSWORD('密码');授权远程链接### 授权192.168.0.1可以远程链接*[所有数据库].*[所有表] 账号:root 密码123456grant all privileges on *.* to 'root'@'192.168.0.1' identified by '123456';### 授权所有ipgrant all privileges on *.* to 'root'@'%' identified by '123456';### 以上*.*表⽰[数据库].[表]### 使授权⽴刻⽣效flush privileges;。
mysql5.7.4数据库源码安装20150520
mysql数据库源码安装1、安装环境系统: Red Hat Enterprise Linux Server release 6.4 (Santiago)64位CUP 4核内存8G硬盘空间160G系统分区 /boot 300M /swap 4096M /home 102400M把剩余全部空间分给根分区。
mysql源码包版本:mysql-5.7.4-m14.tar.gz2 、升级cmake到2.8.9版本查看系统cmake 版本rpm -qa cmake 或cmake --version[root@gztestC118 home]# rpm -qa cmakecmake-2.6.4-5.el6.x86_64[root@gztestC118 home]# cmake --versioncmake version 2.6-patch 4[root@gztestC118 home]#rpm -e cmake-2.6.4-5.el6.x86_64 删除旧的cmake[root@gztestC118 home]# tar –zxvf cmake-2.8.9.tar.gz[root@gztestC118 home]# cd cmake-2.8.9[root@gztestC118 home]./configure[root@gztestC118 home]make &&make install[root@gztestC118 ~]# cmake –version 检查新版本号cmake version 2.8.9 升级成功。
3、拷贝好RHEL系统镜像进入目录Packages[root@gztestC117 Packages]# ll *curses* 把下面安装包安装下。
-r--r--r--. 1 root root 274016 5月 12 06:16 ncurses-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 62400 5月 12 06:16 ncurses-base-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 656772 5月 12 06:16 ncurses-devel-5.7-3.20090208.el6.i686.rpm-r--r--r--. 1 root root 657088 5月 12 06:16 ncurses-devel-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 256596 5月 12 06:16 ncurses-libs-5.7-3.20090208.el6.i686.rpm-r--r--r--. 1 root root 251756 5月 12 06:16 ncurses-libs-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 559700 5月 12 06:16 ncurses-term-5.7-3.20090208.el6.x86_64.rpm [root@gztestC117 Packages]# rpm -ivh ncurses-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-base-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-base-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-base-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:ncurses-devel ########################################### [100%] [root@gztestC117 Packages]# rpm -ivh ncurses-libs-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-libs-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key IDfd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-libs-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-term-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-term-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:ncurses-term ########################################### [100%]利用新安装的cmake指定mysql安装路径解压mysql包,进入mysql源目录cmake -DCMAKE_INSTALL_PREFIX=/home/mysqlinstall/mysql如果未安装curses相关包则会报错CMake Error at cmake/readline.cmake:64 (MESSAGE):Curses library not found. Please install appropriate package。
Linux使用rpm方式安装最新mysql(5.7.16)步骤及常见问题解决方法
Linux使⽤rpm⽅式安装最新mysql(5.7.16)步骤及常见问题解决⽅法前⼏天在阿⾥云买了个服务器,准备⾃⼰玩玩,现将最新版mysql(5.7.16)安装步骤,以及遇到问题及解决过程分享如下:第⼀步:下载rpm包但如果你的下载⽹速不好的话也可以点下⾯的链接下载⾃⼰想要的版本我⽤的是(CentOs6.5)下载的是:mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar⽂件第⼆步:进⾏安装具体如下:1. 检查系统⾃带的MySQL及相关RPM包,是否安装rpm -qa | grep -i mysql如果有安装,则移除(rpm –e 名称)yum -y remove mysql2. 创建⽤户和组(如果已经创建则跳过)groupadd mysqluseradd -r -g mysql mysql3. 解压tar⽂件,并安装进⼊⽂件⽬录运⾏:tar -xf mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar 解压完成,然后依次执⾏。
rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpmrpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpmrpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpmrpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm到此,mysql已经安装完成。
4. 基础配置执⾏:service mysqld start 出现下图表⽰安装成功关闭mysql服务:service mysqld stop初始化(这⾥是以root⾝份执⾏的):bin/mysqld --initialize --user=mysql注:使⽤–initialize会为root账户⽣成⼀个随机的初始密码,我们可以使⽤命令:mysql -u root -p,然后输⼊密码来登录MySQL。
CentOS_6.6用rpm方式安装MySql
CentOS_6.6用rpm方式安装MySql卸载旧版本MySql检查MySQL及相关RPM包,是否安装,如果有安装,则移除[root@MyServer010 ftp]# rpm -qa|grep mysqlmysql-libs-5.1.73-3.el6_5.x86_64[root@MyServer010 ftp]# yum -y remove mysql-libs*移除MySql也可以用下面的命令rpm -e --nodeps mysql-libs-5.1.73-3.el6_5.x86_64下载的MySql文件[root@MyServer010 ftp]# ll-rw-r--r-- 1 root root 18596528 10月21 14:31 MySQL-client-5.6.27-1.el6.x86_64.rpm-rw-r--r-- 1 root root 3392620 10月21 14:31 MySQL-devel-5.6.27-1.el6.x86_64.rpm-rw-r--r-- 1 root root 55950588 10月21 14:32 MySQL-server-5.6.27-1.el6.x86_64.rpm安装MySql[root@MyServer010 ftp]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm注意:安装server时,会有下面的提示,会告知root第一次登录所需的随机密码文件位置。
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下面接着安装[root@MyServer010 ftp]# rpm -ivh MySQL-devel-5.6.27-1.el6.x86_64.rpm[root@MyServer010 ftp]# rpm -ivh MySQL-client-5.6.27-1.el6.x86_64.rpm初始化数据库及设置密码[root@MyServer010 ftp]# /usr/bin/mysql_install_db[root@MyServer010 ftp]# service mysql startStarting MySQL.. SUCCESS![root@MyServer010 ftp]# cat /root/.mysql_secret# The random password set for the root user at Wed Oct 21 14:56:09 2015 (local time): _zh41DmKP_Zzw7vn密码为红字,下面登录MySql[root@MyServer010 ftp]# mysql -uroot -p_zh41DmKP_Zzw7vn修改密码:mysql> set password = password('admin');Query OK, 0 rows affected (0.00 sec)mysql> exit;[root@MyServer010 ftp]# mysql -uroot -padmin以新密码登录成功,则表示新密码设置完成。
centos7环境使用mysql离线安装包安装mysql5.7
centos7环境使⽤mysql离线安装包安装mysql5.7服务器环境:centos7 x64需要安装mysql5.7+⼀、卸载CentOS7系统⾃带mariadb# 查看系统⾃带的Mariadb[root@CDH-141 ~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统⾃带的Mariadb(rpm -e --nodeps)[root@CDH-141 ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64# 删除etc⽬录下的f[root@CDH-141 ~]# rm /etc/f⼆、检查mysql是否存在# 检查mysql是否存在[root@CDH-141 ~]# rpm -qa | grep mysql[root@CDH-141 ~]#三、查看⽤户和组是否存在1)检查mysql组合⽤户是否存在# 检查mysql组和⽤户是否存在,如⽆则创建[root@CDH-141 ~]# cat /etc/group | grep mysql[root@CDH-141 ~]# cat /etc/passwd | grep mysql# 查询全部⽤户(只是做记录,没必要执⾏)[root@CDH-141 ~]# cat /etc/passwd|grep -v nologin|grep -v halt|grep -v shutdown|awk -F ":" '{print $1 "|" $3 "1" $4}' | moreroot|010sync|510flume|9921989hdfs|9911988zookeeper|9891986llama|9881985httpfs|9871984mapred|9861983sqoop|9851982yarn|9841981kms|9831980hive|9821979oozie|9801977hbase|9781975impala|9761973hue|9741971wlaqzc2018|100111001[root@CDH-141 mysql]#2)若不存在,则创建mysql组和⽤户# 创建mysql⽤户组[root@CDH-141 ~]# groupadd mysql# 创建⼀个⽤户名为mysql的⽤户,并加⼊mysql⽤户组[root@CDH-141 ~]# useradd -g mysql mysql# 制定password 为111111 (⽤户mysql的密码)[root@CDH-141 ~]# passwd mysqlChanging password for user mysql.New password:BAD PASSWORD: The password is a palindromeRetype new password:passwd: all authentication tokens updated successfully.四、下载mysql离线安装包tar⽂件官⽹下载地址:版本选择,可以选择⼀下两种⽅式:1)使⽤Red Hat Enterprise LinuxSelect Version:5.7.35Select Operating System:Red Hat Enterprise Linux / Oracle LinuxSelect OS Version:Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit)列表中下载:Compressed TAR Archive:(mysql-5.7.35-el7-x86_64.tar.gz)2)使⽤Linux - GenericSelect Version:5.7.35Select Operating System:Linux - GenericSelect OS Version:Linux - Generic (glibc 2.12) (x86, 64-bit)列表中下载:Compressed TAR Archive:(mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz)【本⽂中使⽤的是这个版本】注意:上边两种⽅式找mysql离线安装包的⽅式都可以。
Linux下安装及配置MySQL详细过程(自己实践总结)
Red Hat Linux下安装及配置MySQL的详细教程大致思路如下:1.下载所需的安装包(Linux下用wget下载,笔者在window下下载的,用XSHELL命令RZ上传到Linux中)2.安装MySQL3.创建新用户并授权安装及配置的详细步骤如下:第一步:检测系统版本信息Linux命令: cat /proc/versionLinux version 2.6.32-220.el6.i686 (mockbuild@) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Wed Nov 9 08:02:18 EST 2011当前Linux版本为RedHat 4.4.5-6(为内核版本)Linux命令:cat /etc/issueRed Hat Enterprise Linux Server release 6.2 (Santiago)Kernel \r on an \mLinux命令: uname -a 或getconf LONG_BITLinux localhost.localdomain 2.6.32-220.el6.i686 #1 SMP Wed Nov 9 08:02:18 EST 2011 i686 i686 i386 GNU/Linux可以看到当前系统为32位的(而64位系统会有x64字符串显示出来)。
第二步:根据Linux系统的环境,下载mysql Community Server官方下载地址: /downloads/mysql/可以选择【Linux-Generic】,下载对应的RMP包.由于当前系统为redhat(64位),所以直接选择Oracle &Red Hat Linux 4 & 5。
Mysql安装包有很多,作用也不同,大多数情况下只需要安装MySQL-Server和MySQL-Client,其它包根据需要安装.32位的下载下面的两个安装包文件:MySQL-server-5.6.11-2.linux_glibc2.5.i386.rpmMySQL-client-5.6.11-2.linux_glibc2.5.i386.rpm(而64位下载下面两个安装包文件:MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpmMySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm)第三步: 安装MySQL安装顺序: 先安装服务器,然后再安装客户端。
linux下mysql的安装卸载和qt-x11的mysql驱动编译
linux下mysql的安装和编译Qt--X11的mysql驱动一、前期准备:本文用redhat Enterprise 5来介绍:1.由于redhat Enterprise 5 中自带一个mysql的版本,如果在安装linux前未选择mysql的安装此步就可跳过,因为我当时安装了现在将其卸载,步骤如下:a. 查找已安装的myslq 版本:#rpm -qa | grep mysql(注意大小写,如果mysql 不行就换MySQL)在屏幕上将显示已安装的mysql包名如:mysql-5.0.22-2.1.0.1 ;b. 将搜索出的包名卸载:#rpm -e --nodeps mysql-5.0.22-2.1.0.1(nodeps表示强制删除)c. 再次查找该包名,如果没有结果输出则表明已将该版本的mysql卸载了;2. 准备安装资源,如下:a. perl-DBI-1.5.2-1.fc6.i386.rpm(该包为是安装mysql的依赖,没它mysql安装不起,查看是否安装,如果安装了就不需要了,可以通过#rpm -qa | grep perl*查看是否已经安装,该包在linux系统盘上可以找到,以下提供该包下载)b.MySQL-server-community-5.1.51-1.rhel5.i386.rpm和MySQL-client-community-5.1.51-1.rhel5.i386.rpm 和MySQL-devel-community-5.1.51-1.rhel5.i386.rpm(此包主要用于编译linux下的Qt--x11的mysql驱动)(可以从/downloads/mysql/5.1.html下载相应linux相应的版本)c. 准备好相应的安装包传到linux系统/home上;3. 开始安装:a. 先安装perl-DBI-1.5.2-1.fc6.i386.rpm可以通过#rpm -qa | grep perl*查看是否已经安装,如果安装了就不需要安装,我的是已经安装好的。
CentOS8下MySQL8.0安装部署的方法
CentOS8下MySQL8.0安装部署的⽅法MySQL 8正式版8.0.11已发布,官⽅表⽰MySQL8要⽐MySQL 5.7快2倍,还带来了⼤量的改进和更快的性能!到底谁最⽜呢?请看:MySQL 5.7 vs 8.0,哪个性能更⽜?Mysql8.0安装 (YUM⽅式)1、⾸先删除系统默认或之前可能安装的其他版本的mysql# for i in $(rpm -qa|grep mysql);do rpm -e $i --nodeps;done# rm -rf /var/lib/mysql && rm -rf /etc/f2、安装Mysql8.0 的yum资源库mysql80-community-release-el7-1.noarch.rpm# yum localinstall https:////mysql80-community-release-el7-1.noarch.rpm3、安装Mysql8.0# yum install mysql-community-server#启动MySQL服务器和MySQL的⾃动启动# systemctl start mysqld# systemctl enable mysqld# systemctl status mysqld[root@localhost opt]# netstat -lantp | grep 3306tcp6 0 0 :::33060 :::* LISTEN 25431/mysqldtcp6 0 0 :::3306 :::* LISTEN 25431/mysqld[root@localhost opt]# ps -aux | grep mysqldmysql 25431 0.8 17.2 1776932 350232 ? Ssl 16:24 0:01 /usr/sbin/mysqldroot 25672 0.0 0.0 112828 980 pts/1 S+ 16:28 0:00 grep --color=auto mysqld登录报错跳过密码登录,添加skip-grant-tables,然后重启MySQL服务。
Rhel7安装mysql5.7详细步骤
会看到很多的rpm包,但是我们需要的就下面的4个rpm包,安装的时候需要依次执行
次执行命令:
rpm -ivh mysql-community-common-5.7.9-1.el7.x86_64.rpm
5.启动mysql服务
systemctl start mysqld
若遇到mysql服务不能正常启动。
错误为:Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.
并及时为root用户添加密码 mysql -u root --skip-password
在进行初始化的时候,mysqld服务会检查数据目录是否存在,如下:
如果数据目录不存在,mysqld则会创建它。
如果数据目录存在,且不是空目录(即包含有文件或子目录),mysqld会显示一条错误信息并中止:
如果还出现和下图一样的提示,我们执行另一条命令:chown -R mysql:mysql /var/lib/mysql,
将/var/lib/mysql目录及其下所有文件和子目录的所有者和所属组都改为mysql。我们再执行一下:systemctl start mysqld应该就可以启动mysqld服务了。
7.修改mysql默认数据库存放目录
systemctl stop mysqld
复制 cp -a -R -rf /var/lib/mysql /md0/data/
REDHAT linux下安装MYSQL
LINUX 下安装配置MYSQL1,下载MYSQL安装程序地址:/downloads/mysql/选择你所安装环境下的服务器:分别下载SERVER程序:MySQL-server-community-5.1.44-1.rhel5.i386.rpmCLIENT工具:MySQL-client-community-5.1.44-1.rhel5.i386.rpm2,通过本地SSH Secure工具将文件上传到服务器1)安装服务器端在有两个rmp文件的目录下运行如下命令:[root@test1 local]# rpm -ivh MySQL-server-community-5.1.44-1.rhel5.i386.rpm显示如下信息:Preparing...########################################### [100%]1:MySQL-server ########################################### [100%]2)测试是否安装成功[root@test1 local]# netstat -natpl显示3306端口开放表示服务安装成功3)安装客户端工具[root@test1 local]# rpm -ivh MySQL-client-community-5.1.44-1.rhel5.i386.rpmPreparing...########################################### [100%]1:MySQL-client########################################### [100%]显示安装完成4)测试连接[root@test1 local]# mysql出现如下提示符mysql>表示登陆成功。
以上登陆情况是在没有设置密码的情况下登陆,在设置防火墙前注意对MYSQL设置密码5)对MYSQL用户ROOT设置密码[root@test1 local]# /usr/bin/mysqladmin -u root password 123456注:123456只是事例密码,实际配置过程中注意相关密码复杂性要求6) 对mysql用户设置远程访问权限方法1,改表法。
CENTOS7环境安装MySQL5.6(rpm_二进制_源代码编译三种方式)
CENTOS7环境安装MySQL软件环境虚拟机:VMware® Workstation-10.0.1 build-1379776-Win Linux:Centos 7 X86_64MySQL Database: MySQL-5.6.24系统环境MySQL软件安装一、使用RPM安装。
安装采用RPM安装包安装。
下载mysql:/downloads/mysql/打开页面之后,在Select Platform:下选择linux Generic下载后的包为名称为:MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar(一)卸载原有MySQL或者Mariadb安装程序1、CentOs7版本默认情况下安装了mariadb-libs,必须先卸载才可以继续安装MySql。
a) 查找以前是否安装mariadb-libs# rpm -qa | grep -i mariadb-libsb)卸载已经安装的mariadb-libs# yum remove mariadb-libs-5.5.41-2.el7_0.x86_642、查找以前是否安装MySQL# rpm -qa | grep -i mysql--说明已经有安装了MySQL程序a)停止mysql服务# sudo service mysql stop或者:# ps -A | grep mysql# kill -9 进程号b)删除之前安装的mysql# rpm -ve MySQL-server-5.6.24-1.linux_glibc2.5.x86_64# rpm -ve MySQL-client-5.6.24-1.linux_glibc2.5.x86_64c)查找之前老版本mysql的目录、并且删除老版本mysql的文件和库# find / -name mysql【查找结果如下】# find / -name mysql/var/lib/mysql/usr/lib64/mysql/usr/local/mysql/usr/local/mysql/data/mysql【删除对应的目录】# rm -rf /var/lib/mysql# rm -rf /usr/lib64/mysql# rm -rf /usr/local/mysql【删除配置文档】# rm -rf /etc/fd)再次查找机器是否安装mysql# rpm -qa|grep -i mysql【无结果,说明已经卸载彻底、接下来直接安装mysql即可】(二)下载和解压、安装【创建一个任意名称文件夹,如:rpm】# mkdir rpm# cd rpm【下载安装包的压缩文档】# wget /Downloads/MySQL-5.6/MySQL-5.6.17-1.el6.x8 6_64.rpm-bundle.tar# tar –xvf MySQL-5.6.17-1.el6.x86_64.rpm-bundle.tar【创建mysql用户和数据目录】#groupadd mysql#useradd -r -g mysql mysql#cd /usr/local#sudo mkdir mysql#cd mysql#sudo mkdir mysql#sudo chown -R mysql .#sudo chgrp -R mysql .【安装RPM包】#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm如果出现错误:FATAL ERROR: please install the following Perl modules beforeexecuting ./scripts/mysql_install_db:Data::Dumper先用yum list 查找下module:# yum list|grep -i perl-modul*# yum install -y perl-Module-Install.noarch#rpm -ev MySQL-server-5.6.24-1.linux_glibc2.5.x86_64重新执行:#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm【初始化MySql配置文件】#cp f /etc/f可以简单修改配置如下。
MySQL5.7在CentOS7上的安装
在CentOS7上安装MySQL5.7.9时间:2015-11-07 作者:dusuanyun系统版本:CentOS-7-x86_64-DVD-1503-01.iso 安装后不要升级!!!(我试过升级后安装MySQL不能启动)网络环境:虚拟机桥接,可以连接外网:安装方式:手动网络安装---仓库的方式需要的文件:如下图。
PDF文件为官方指导文件。
1.将mysql57-community-release-el7-7.noarch.rpm文件置于CentOS的Root家目录:[root@MySQL ~]# ll总用量16-rw-------. 1 root root 1665 11月7 10:49 anaconda-ks.cfg-rw-r--r--. 1 root root 8984 11月7 11:13 mysql57-community-release-el7-7.noarch.rpm2.开始安装:按照提示一步步安装即可[root@MySQL ~]# rpm -ivh mysql57-community-release-el7-7.noarch.rpm[root@MySQL ~]# yum install mysql-community-server3.查看支持当前系统的可以安装MySQL的其他组件:[root@MySQL ~]# yum --disablerepo=\* --enablerepo='mysql*-community*' list available4.查看安装后的MySQL的服务是否已经启动:[root@MySQL ~]# service mysqld statusRedirecting to /bin/systemctl status mysqld.servicemysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)Active: inactive (dead)5.没有启动,则启动MySQL服务:[root@MySQL ~]# service mysqld startRedirecting to /bin/systemctl start mysqld.service检查是否正常启动,[root@MySQL ~]# service mysqld statusRedirecting to /bin/systemctl status mysqld.servicemysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)Active: active (running) si nce 六2015-11-07 11:24:02 CST; 14s agoProcess: 3157 ExecStart=/usr/sbin/mysqld --daemonize $MYSQLD_OPTS (code=exited, status=0/SUCCESS)6.查看安装MySQL后自动产生的随机Root密码:此Root密码是数据库的不是CentOS系统的[root@MySQL ~]# grep 'temporary password' /var/log/mysqld.log2015-11-07T03:23:44.719982Z 1 [Note] A temporary password is generated for root@localhost: JfHhiPk,n2Pw7.用随机密码登录MySQL并修改Root密码:[root@MySQL ~]# mysql -u root -pJfHhiPk,n2Pwmysql> use mysqlERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. 密码必须满足复杂性的策略mysql> SET PASSWORD FOR 'root'@'localhost'= "pw57mysql";ERROR 1819 (HY000): Your password does not satisfy the current policy requirementsmysql> SET PASSWORD FOR 'root'@'localhost'= "PW57-mysql";Query OK, 0 rows affected (0.00 sec)mysql> exitBye8.用新的密码登录,修改MySQL表支持非本机连接:[root@MySQL ~]# mysql -u root -pPW57-mysqlmysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select host, user from user; -----修改前+-----------+-----------+| host | user |+-----------+-----------+| localhost | mysql.sys || localhost | root |+-----------+-----------+2 rows in set (0.00 sec)mysql> update user set host = '%' where user = 'root'; ---修改Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> select host, user from user; -----修改后+-----------+-----------+| host | user |+-----------+-----------+| % | root || localhost | mysql.sys |+-----------+-----------+2 rows in set (0.00 sec)mysql> flush privileges; ------刷新,让修改立即生效!Query OK, 0 rows affected (0.00 sec)mysql>Bye9.检查CentOS的防火墙设置:因为发现其他机器可以ping通,连数据库却不通。
linux下安装mysql(rpm文件安装)
linux下安装mysql(rpm⽂件安装)数据库包下载:在GPL开原协议的社区开源版⾥边下载我们⽤mysql community server⾥边的其中workbench是客户端⼯具MySQL Cluster是oracle⾃⼰搞的集群版的(集成了⼀些开源⼯具和增值服务)选择操作系统和版本建议在linux下安装也可以选择版本下载server包和client包如果是server包,那架构图⾥的东西都有了还要下个client utilities包,客户端包,类似connection层下载后⽤rz命令传到centos linux系统⾥边rpm是包管理器xshell可以直接拖也可以⽤rz命令,没有的话安装⼀下: yum install lrzszyum是包资源管理器,可以解决包依赖的问题,把需要的包都下载下来传到linux系统安装mysql步骤:清理环境centos7会⾃带⼀个mariadb查看是否已安装rpm -qa |grep -i mysqlrpm -qa |grep -i mariadb(centos7默认系统⾃带的)mariadb是从mysql来的,是它的⼀个分⽀,需要清理掉清理掉mariadb包⽤yum直接安装你的话,⽤的mariadb的yum源,它跟mysql官⽅正式版不太⼀样,我们要安装官⽅正式版,就需要清掉mariadb,然后⼿动安装⾃⼰下载的官⽅正式版mysqlrpm -e 加上包名,把mariadb包清掉可以看到⽤rpm删除会失败,提⽰有依赖关系的软件需要安装rpm -e mariadb-libs-5.5.56-2.el7.x86_64rpm删除时如果有依赖关系,可以⽤yum remove + 包名来删除mariadb开始安装:⼀般⽤装软件⽤yum直接安装也可以,但是有⼀个问题:⽤yum的话,是到默认的mariadb⽤的yum源去找,可能会找不到,所以我们⾃⼰来安装rpm –ivh + 包安装所需要的包rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpmrpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpmserver安装成功后会输出⼀些信息,如下:[root@localhost soft]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpmwarning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing...1:MySQL-server-5.6.42-1.el7 ################################# [100%]warning: user mysql does not exist - using rootwarning: group mysql does not exist - using rootwarning: user mysql does not exist - using rootwarning: group mysql does not exist - using root2018-11-18 13:53:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-11-18 13:53:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2018-11-18 13:53:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6420 ...2018-11-18 13:53:24 6420 [Note] InnoDB: Using atomics to ref count buffer pool pages2018-11-18 13:53:24 6420 [Note] InnoDB: The InnoDB memory heap is disabled2018-11-18 13:53:24 6420 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-11-18 13:53:24 6420 [Note] InnoDB: Memory barrier is not used2018-11-18 13:53:24 6420 [Note] InnoDB: Compressed tables use zlib 1.2.112018-11-18 13:53:24 6420 [Note] InnoDB: Using Linux native AIO2018-11-18 13:53:24 6420 [Note] InnoDB: Using CPU crc32 instructions2018-11-18 13:53:24 6420 [Note] InnoDB: Initializing buffer pool, size = 128.0M2018-11-18 13:53:24 6420 [Note] InnoDB: Completed initialization of buffer pool2018-11-18 13:53:24 6420 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2018-11-18 13:53:24 6420 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2018-11-18 13:53:24 6420 [Note] InnoDB: Database physically writes the file full: wait...2018-11-18 13:53:24 6420 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2018-11-18 13:53:25 6420 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2018-11-18 13:53:25 6420 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02018-11-18 13:53:25 6420 [Warning] InnoDB: New log files created, LSN=457812018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer not found: creating new2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer created2018-11-18 13:53:25 6420 [Note] InnoDB: 128 rollback segment(s) are active.2018-11-18 13:53:25 6420 [Warning] InnoDB: Creating foreign key constraint system tables.2018-11-18 13:53:25 6420 [Note] InnoDB: Foreign key constraint system tables created2018-11-18 13:53:25 6420 [Note] InnoDB: Creating tablespace and datafile system tables.2018-11-18 13:53:25 6420 [Note] InnoDB: Tablespace and datafile system tables created.2018-11-18 13:53:25 6420 [Note] InnoDB: Waiting for purge to start2018-11-18 13:53:25 6420 [Note] InnoDB: 5.6.42 started; log sequence number 0A random root password has been set. You will find it in '/root/.mysql_secret'.2018-11-18 13:53:26 6420 [Note] Binlog end2018-11-18 13:53:26 6420 [Note] InnoDB: FTS optimize thread exiting.2018-11-18 13:53:26 6420 [Note] InnoDB: Starting shutdown...2018-11-18 13:53:27 6420 [Note] InnoDB: Shutdown completed; log sequence number 16259772018-11-18 13:53:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-11-18 13:53:27 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2018-11-18 13:53:27 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6444 ...2018-11-18 13:53:27 6444 [Note] InnoDB: Using atomics to ref count buffer pool pages2018-11-18 13:53:27 6444 [Note] InnoDB: The InnoDB memory heap is disabled2018-11-18 13:53:27 6444 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-11-18 13:53:27 6444 [Note] InnoDB: Memory barrier is not used2018-11-18 13:53:27 6444 [Note] InnoDB: Compressed tables use zlib 1.2.112018-11-18 13:53:27 6444 [Note] InnoDB: Using Linux native AIO2018-11-18 13:53:27 6444 [Note] InnoDB: Using CPU crc32 instructions2018-11-18 13:53:27 6444 [Note] InnoDB: Initializing buffer pool, size = 128.0M2018-11-18 13:53:27 6444 [Note] InnoDB: Completed initialization of buffer pool2018-11-18 13:53:27 6444 [Note] InnoDB: Highest supported file format is Barracuda.2018-11-18 13:53:27 6444 [Note] InnoDB: 128 rollback segment(s) are active.2018-11-18 13:53:27 6444 [Note] InnoDB: Waiting for purge to start2018-11-18 13:53:27 6444 [Note] InnoDB: 5.6.42 started; log sequence number 16259772018-11-18 13:53:27 6444 [Note] Binlog end2018-11-18 13:53:27 6444 [Note] InnoDB: FTS optimize thread exiting.2018-11-18 13:53:27 6444 [Note] InnoDB: Starting shutdown...2018-11-18 13:53:29 6444 [Note] InnoDB: Shutdown completed; log sequence number 1625987A 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_installationwhich 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 /The latest information about MySQL is available on the web atSupport MySQL by buying support/licenses at WARNING: Found existing config file /usr/f 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/f,please compare it with your file and take the changes you need.其中有两句指明mysql安装时给root设置了⼀个随机的初始密码:密码的位置放在'/root/.mysql_secret'⽂件中⽤于第⼀次登陆mysql时使⽤的,登陆之后会强制修改⼀下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.查看该⽂件,可以看到我在重装mysql时新⽣成⼀个随机密码ps –ef|grep –i mysql 看是否有mysql进程⽤rpm –qa |grep –I mysql看下mysql是否安装成功了,看到两个mysql的组件,就是安装成功了5.6以后要设置⼀个root账号的随机密码密码保存到root/.mysql_secret⽂件⾥后边需要⽤这个初始的密码登录mysql启动服务:service mysql startps –ef |grep mysql 看有没有mysql服务登录数据库:mysql –uroot –p 敲回车然后输⼊随机密码登录后,提⽰⼀些信息如连接线程id、版本什么的show databases; 查看数据库有哪些库在使⽤前要设置⼀个⾃⼰的密码会要求重置随机密码重置密码⽅法:set password=password(‘root’);是给当前⽤户设置密码为root再运⾏ show databases;mysql会⾃带⼀些系统库:information_schema存⼀些统计数据performance_schema存⼀些状态数据,mysql存的数据⽤于监控、权限、账号等test是测试库,⽤于做测试⽤的如果重新安装,数据⽬录没变的话,那么之前的库还是存在的。
Linuxcentos7环境下MySQL安装教程
Linux centos7环境下MySQL安装教程MySQL所使用的SQL 语言是用于访问数据库的最常用标准化语言。
那么你知道Linux centos7环境下MySQL安装教程么?接下来是小编为大家收集的Linux centos7环境下MySQL安装教程,欢迎大家阅读:Linux centos7环境下MySQL安装教程1)、my.ini 保存到/etc/my.ini2)、用户权限,单独用户执行一、查找以前是否安装有mysql,使用下面命令:rpm –qa | grep -i mysql如果显示有如下包则说明已安装mysqlmysql-4.1.12-3.RHEL4.1mysqlclient10-3.23.58-4.RHEL4.1二、下载mysql解压包mysql-5.7.17-linux-glibc2.5-x86_64.tar (去网站上下载)网址:/mysql/MySQL-5.7/也可以在Linux操作系统底下进行下载,输入如下命令wget /mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz创建目录software用于存放我们待会要下载的mysql包,先去到该目录输入命令:cd /software下载完成后,你会在software目录下看到多出一份mysql安装包文件三、建立用户,以及mysql的目录1、groupadd mysql #建立一个mysql的组2、useradd -r -g mysqlmysql #建立mysql用户,并且把用户放到mysql组3、passwd mysql #给mysql用户设置一个密码四、解压mysql安装包1、先把tar.gz包移动到/usr/local 目录下,输入命令mv /software/MySQL/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz/usr/local2、解压tar.gz包先去到/usr/local 目录下,输入命令cd /usr/local解压命令 tarzxvfmysql-5.7.17-linux-glibc2.5-x86_64.tar.gz输入查看目录命令 ll会发现多出目录 mysql-5.7.17-linux-glibc2.5-x86_64注意:没有data 目录,my.ini文件在support-files 目录下3、改一下目录名字为 /usr/local/mysql(这是linux下mysql的默认安装安装目录)把解压出来的文件改下名字,改为mysql输入命令: mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql五、配置相关的启动配置文件首先要去到support-files/文件目录下输入命令: cd support-files/1、复制f 到 /etc/f (mysql启动时自动读取)输入命令 f /etc/f2、解决乱码问题输入命令:vi /etc/f (进入可编辑状态)更改:[mysql]default-character-set=utf8(表示解决客户端乱码问题)[mysqld]default-storage-engine=INNODBcharacter_set_server=utf8(表示解决服务端乱码问题)3、复制mysql.server 到/etc/init.d/ 目录下【目的想实现mysqld -install这样开机自动执行效果】输入命令 cp mysql.server /etc/init.d/mysql (mysql是服务名)注意:/etc/init.d/ 目录,等效于注册表HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services记录有那些服务4、修改/etc/init.d/mysql 参数输入命令 vi /etc/init.d/mysql给与两个目录位置basedir=/usr/local/mysqldatadir=/usr/local/mysql/data5、给目录/usr/local/mysql 更改拥有者输入命令 chown -R mysql:mysql /usr/local/mysql/六、初始化mysql的数据库1、初始化mysqlmysql_install_db (老版本的做法)新版本:初始化输入命令./mysqld --initialize --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 生成出一个data目录,代表数据库已经初始化成功并且mysql的root用户生成一个临时密码:(记录下临时密码XXX)2、给数据库加密输入命令./mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data3、启动mysql输入命令 ./mysqld_safe --user=mysql & (&符表示提交到后台运行mysql服务)七、进入客户端1、登录输入命令 ./mysql -uroot -p然后再输入你的临时密码2、修改密码输入命令set password=password(‘xxxx')八、window远程访问Linux虚拟机的mysql先来看看数据库结构1、关闭防火墙 (或者给防火墙开放端口),这样window才能连接上输入命令 systemctl stop firewalld.service2、给Windows授权输入命令mysql>grant all privileges on *.* toroot@'%' identified by '123456';mysql>use mysql;mysql>select host,user from user;【多出一条远程登录用户记录】mysql>flush privileges;3、远程链接数据库,或者重启(init 6)。
安装rpm的方法
Ubuntu的软件包格式是deb,如果要安装rpm的包,则要先用alie n把rpm转换成de b。
sudoapt-g et in stall alie n #al ien默认没有安装,所以首先要安装它sudo alie n xxx x.rpm #将rp m转换位d eb,完成后会生成一个同名的x xxx.d ebsudodpkg-i xx xx.de b #安装注意,用ali en转换的deb包并不能保证100%顺利安装,所以可以找到d eb最好直接用deb有时候,我们想要使用的软件并没有被包含到U buntu的仓库中,而程序本身也没有提供让 Ub untu可以使用的 deb包,你又不愿从源代码编译。
但假如软件提供有rpm包的话,我们也是可以在 Ub untu中安装的。
方法一:1. 先安装 ali en 和faker oot 这两个工具,其中前者可以将 rp m 包转换为 deb包。
安装命令为:sud o apt-getinsta ll al ien f akero ot2. 将需要安装的rpm 包下载备用,假设为p ackag e.rpm。
3. 使用alien将 rp m 包转换为 deb包:fake rootalien pack age.r pm4. 一旦转换成功,我们可以即刻使用以下指令来安装:s udo d pkg -i pac kage.deb 方法二:1.CODE:su do ap t-get inst all r pm al ien 2.CO DE: alie n -dpacka ge.rp m3.CODE:s udo d pkg -i pac kage.deb在Ubun tu下安装exe软件要wine,而安装r pm软件要alien。
mysql5.8安装指南
mysql5.8安装指南⼀、安装mysql yum源从官⽹下载mysql最新的yum源的rpm安装包wget //mysql57-community-release-el6-9.noarch.rpm使⽤yum安装rpm包yum install mysql57-community-release-el6-9.noarch.rpm检测mysql yum源yum repolist enabled | grep "mysql.*-community.*"⼆、从mysql yum源中选择mysql安装版本1、查看mysql yum仓库的资源yum repolist all | grep mysql2、修改msql yum源配置中的enabled选项,如要安装mysql5.8,将mysql57-community中的enabled=1修改为enabled=0 vi /etc/yum.repos.d/mysql-community.repo[mysql57-community]name=MySQL 5.7 Community Serverbaseurl=/yum/mysql-5.7-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql将mysql80-community中enabled=0修改为enabled=1# Enable to use MySQL 8.0[mysql80-community]name=MySQL 8.0 Community Serverbaseurl=/yum/mysql-8.0-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql3、查看当前yum源可以安装的版本yum repolist enabled | grep mysql三、安装mysqlyum install mysql-community-server四、启动mysql服务器service mysqld startmysql启动过程中,会⾃动进⾏以下操作:1、初始化msql2、⼀个SSL证书和密钥⽂件在数据⽬录中⽣成(/var/lib/mysql)。
MySQL 5 rpm版本 for linux安装
一、从官网下载MySQL Community Server/downloads/选择相应的系统,通常linux选择Linux-Generic下载即可二、创建用户首先创建mysql用户,组mysql,根目录/home/mysql或者命令groupaddmysqluseradd -g mysql -d /home/mysqlmysql三、将安装包ftp传至/home/mysql/install 下解压(最好建一个install目录,因为会解压出来很多包)四、安装1、先查看原主机上又没有mysql(root用户操作)最后加了个--nodeps参数解决,2、安装server和client3、安装完启动./mysql.server脚本是调用/usr/bin/mysqld_safe来启动mysql的4、查看mysql是否启动,看进程+3306端口5、设定root用户密码这是第一次设定,如果修改就是mysqladmin -u root -p 旧密码password新密码6、尝试连接7、修改可以远程登录mysql>use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select host,user, Password ,Select_priv from user;mysql> grant all on *.* to root@'%' identified by '6543210';Query OK, 0 rows affected (0.00 sec)mysql>GRANT USAGE ON *.* TO 'root'@'%' WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)mysql> select host,user from user where user='root';mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)修改用户密码mysql>use mysql;mysql>update user set password=password('新密码') WHERE User='root' and host='%'; mysql>flush privileges;√8、修改字符集查看原字符集:mysql>use mysqlReading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changedmysql> show variables like 'character_set%' ;mysql> show variables like 'collation_%';需要将/usr/share/mysql/fffff9、修改SQL不区分大小写在/etc/f中的[mysqld]后添加lower_case_table_names=1,重启MYSQL 服务10、支持procedure或者function编译及执行在mysql中编译或者执行procedure或者function时,可能会报如下错误This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)两种方法(1)在/etc/f中的[mysqld]后添加添加log_bin_trust_function_creators = 1,重启MYSQL服务(2)在控制台执行SQL> set global log_bin_trust_function_creators = 1;不过重启后会失效五、启动停止六、基本使用mysql> show databases; //查看数据库mysql> use test//选择数据库Database changedmysql> show tables;//查看表Empty set (0.00 sec)mysql> create table gl(id int(3) auto_increment not null primary key, name char(10) not null);//创建表Query OK, 0 rows affected (0.01 sec)mysql> select * from gl;Empty set (0.00 sec)mysql> show tables;//再次查看表mysql> insert into gl values("",'Guolei');//插入数据Query OK, 1 row affected, 1 warning (0.00 sec)mysql> select * from gl;//查询数据mysql> exitBye七、备份数据库使用mysqldump命令备份备份出来的test.bbb是个文本文件,可以使用more或者cat打开使用mysqldump命令导入备份备份注意:mysqldump: Got error: 1066: Not unique table/alias: 'pmamap' when using LOCK TABLES 需要加上--lock-tables=false参数。