Centos6.5安装mysql 5.7
1、在官网下载安装包:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
2、将安装包上传到centos上我安装的目录是在 /usr/local/
[root@localhost bin]# cd /
[root@localhost /]# cd usr
[root@localhost usr]# cd local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# rz [root@localhost local]# ls
bin etc games include lib lib64 libexec mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz sbin share src
[root@localhost local]# tar -xzvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
3、将压缩包解压:tar -xzvf mysql-5.7.10...
10 [root@localhost local]# tar -xzvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
4、重命名解压后的文件: mv mysql-5.7.10... mysql
[root@localhost local]# ls
bin games lib libexec mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz share
etc include lib64 mysql-5.7.10-linux-glibc2.5-x86_64 sbin src
[root@localhost local]# mv mysql-5.7.10-linux-glibc2.5-x86_64 mysql
[root@localhost local]# ls
bin etc games include lib lib64 libexec mysql mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz sbin share src
5、启动mysql的安装文件
[root@localhost mysql]# ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2017-09-28 11:21:54 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-09-28 11:21:59 [WARNING] The bootstrap log isn't empty:
2017-09-28 11:21:59 [WARNING] 2017-09-28T03:21:55.455859Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
注意warning部分:mysql_install_db已经被取代了:
./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
6、设置mysql的my.cnf配置 ( 将mysql下的文件复制一份到/etc/目录下 )
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
7、修改my.cnf里面的内容:
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
socket=/usr/local/mysql/mysqld.sock [client]
default-character-set=utf8
socket=/usr/local/mysql/mysqld.sock [mysql]
default-character-set=utf8
socket=/usr/local/mysql/mysqld.sock
一开始没有设置mysql的socket,而报
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
设置好socket 就解决了,其实创建软连接也是不错的选择:ln -s /usr/local/mysql/mysqld.sock /tmp/mysql.sock
如果mysql启动不了
拷贝启动文件到/etc/init.d/下并重命令为mysqld
/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
8、启动mysql :
[root@localhost etc]# service mysqld restart
9、提示修改密码:
[root@localhost etc]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost etc]# mysql -uroot -p
Enter password:
10、查看mysql的默认密码:
[root@localhost ~]# cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2017-09-28 11:21:55
UQ?x&q+gu#o*
11、用默认密码登录后修改默认密码:
mysql> set password = password("root")
-> ;
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) mysql> use mysql
然后就可以自己对数据库进行相应的操作了。
12、开启远程连接
mysql> select host,user ,password from user;
+-----------------------+------+-------------------------------------------+
| host | user | password |
+-----------------------+------+-------------------------------------------+
| % | root | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| localhost.localdomain | root | |
| 127.0.0.1 | root | |
| :: | root | |
| localhost | | |
| localhost.localdomain | | |
+-----------------------+------+-------------------------------------------+
mysql> update user set host = '%' where user = 'root';
mysql> grant all privileges on *.* to root@'%' identified by "password" with grant option;
mysql> flush privileges;
如果需要指定特定的ip地址,可以直接用grant all privileges on *.* to root@'ip' identified by "password" with grant option;
问题总结:
一、 Starting MySQL.The server quit without updating PID file (/[FAILED]l/mysql/data/mysql.pid).
网上说了很多但都不是自己出现的
Google了下 ,问题可能的原因有多种,具体什么原因最好的办法是先查看下错误日志:
1、可能是/usr/local/mysql/data/mysql.pid文件没有写的权限
解决方法 :给予权限,执行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新启动mysqld!
2、可能进程里已经存在mysql进程
解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9 进程号”杀死,然后重新启动mysqld!
3、可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。
解决方法:去mysql的数据目录/data看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸首了。本人就是使用第三条方法解决的 !
4、mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。
解决方法:请在[mysqld]下设置这一行:datadir = /usr/local/mysql/data
5、skip-federated字段问题
解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。
6、错误日志目录不存在
解决方法:使用“chown” “chmod”命令赋予mysql所有者及权限
7、selinux惹的祸,如果是centos系统,默认会开启selinux
解决方法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。
8、[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root
解决方法:在/mysql/my.cnf文件中,指定user=mysql 或强制使用root启动 mysqld --user=root
9、 [Note] Plugin 'FEDERATED' is disabled../mysqld: Table 'mysql.plugin' doesn't exist
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
解决方法:./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
自己问题解决方式:
10、本地root用户连接问题Access denied for user 'root'@'localhost' (using password: YES)
解决方法:授权root用户权限 grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;
/etc/my.cnf的配置文件参数少了或者错误
一份正确的配置参数:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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. #[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 = .....
# port = .....
# server_id = .....
# socket = .....
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
user=mysql
socket=/usr/local/mysql/mysqld.sock
log-bin=mysql-bin
server-id=1
pid-file = /usr/local/mysql/data/mysql.pid port=3306
socket=/usr/local/mysql/mysqld.sock
log-bin=mysql-bin
server-id=1
pid-file = /usr/local/mysql/data/mysql.pid binlog_format=row
binlog-row-image = full
max_binlog_size =128M
binlog_cache_size =2M
expire_logs_days =7 [client]
default-character-set=utf8
socket=/usr/local/mysql/mysqld.sock #[mysql]
#default-character-set=utf8
#socket=/usr/local/mysql/mysqld.sock # 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
[Reference]
[1] http://www.jb51.net/article/117722.htm
Centos6.5安装mysql 5.7的更多相关文章
- Centos6.5 安装MYSQL 5.5 -5.6.-5.7 一键yum快速安装 ,初始配置
Centos6.5 安装MYSQL 5.5 ---5.6---5.7 一键yum快速安装 ,初始配置 第一步:安装mysql-5.5---- 5.6 ---- 5.7的yum源 [root@sv03 ...
- Mysql系列三:Centos6下安装Mysql和Mysql主从复制的搭建
一.Centos6下安装Mysql 检测下系统有没有自带的mysql:yum list installed | grep mysql, 如果已经有的话执行命令yum -y remove mysql-l ...
- 【转】CentOS6下安装mysql后,重置root密码方法
本文转自:CentOS6下安装mysql后,重置root密码方法 centos下安装mysql,居然不知道root用户密码,本想重装,不过还是先度娘了一些,发现这篇文章,刚好解决我的燃眉之急,太赞了. ...
- CentOS6.9安装MySQL(编译安装、二进制安装)
目录 CentOS6.9安装MySQL Linux安装MySQL的4种方式: 1. 二进制方式 特点:不需要安装,解压即可使用,不能定制功能 2. 编译安装 特点:可定制,安装慢 5.5之前: ./c ...
- 在Centos6.5安装MySQL
在阐述安装过程之前一定要再写一句,Centos7上安装MySQL是默认安装的MariaDB,因为在Centos7中用MariaDB代替了mysql数据库. linux安装软件很简单,有的时候只有一句话 ...
- Centos6.7安装mysql 5.6简单教程
今天项目经理让我给服务器配一下mysql,以前配置mysql的时候,感觉好麻烦,前几天也帮朋友配置来着,今天装的时候一直报错,百度也没搞明白,所以打算换种方法装mysql,无意中发现了还有这种操作,容 ...
- CentOS6.5安装mysql以及常见问题的解决
前言 最近在学习Linux系统,今天在安装MySQL数据库时出现很多问题,花费了两个小时终于解决,故记录下来以供大家参考.(本人目前还在学习阶段,下面写到的是自己结合网上查到的资料以及各位前辈给出的解 ...
- 36. CentOS-6.3安装Mysql集群
安装要求 安装环境:CentOS-6.3安装方式:源码编译安装 软件名称:mysql-cluster-gpl-7.2.6-linux2.6-x86_64.tar.gz下载地址:http://mysql ...
- centos6.5 安装mysql
在centos6.5上通过yum安装mysql: 1. yum list |grep mysql (查看版本) 2.安装mysql yum install -y mysql-server mysq ...
- 阿里云服务器CentOS6.9安装Mysql
上篇讲了CentOS6.9安装tomcat,这篇来讲mysql的安装 1.查看CentOS是否安装了MySQL yum list installed | grep mysql //查看CentOS是否 ...
随机推荐
- highcharts学习1----Line charts
今天开始将之前使用的highcharts控件的经验进行总结和整理,一方面方便自己以后使用查询,同时也为正在学习的人们做一些指引,算是资源分享吧. 官网链接: http://www.highcharts ...
- Python中使用MongoEngine
pymongo来操作MongoDB数据库,但是直接把对于数据库的操作代码都写在脚本中,这会让应用的代码耦合性太强,而且不利于代码的优化管理 一般应用都是使用MVC框架来设计的,为了更好地维持MVC结构 ...
- Ubuntu下使用dialog制作菜单执行简单脚本
新建test5 #!/bin/bash #using select in the menu temp=$(mktemp -t test.XXXXXX) temp2=$(mktemp -t test2. ...
- 【QT】error: macro "SIGNAL" passed 3 arguments, but takes just 1
error: macro "SIGNAL" passed 3 arguments, but takes just 1 错误原因: "SIGNAL"后面括号掉了. ...
- jQuery easyUI的datagrid,如何在翻页以后仍能记录被选中的行
1.先给出问题解决后的代码 <%@ page language="java" import="java.util.*" pageEncoding=&quo ...
- ITIL之“变更管理”
首先要说明的是ITIL的变更是指“上线系统的变更”,而不是指系统建设的变更. ITIL的变更的流程如下: 整个变更管理在实际操作中有几个注意点: 1. 现存的企业中,变更咨询委员会(CAB)可能只有信 ...
- ios利用Reachability确认网络环境3G/WIFI(转)
iPhone开发技巧之网络篇(4)--- 确认网络环境 开发Web等网络应用程序的时候,需要确认网络环境,连接情况等信息.如果没有处理它们,是不会通过Apple的审查的. Apple 的 例程 Re ...
- Linux+Redis实战教程_day03_Redis-set【重点】_有序set(了解)
2.redis-set[重点] Java HashSet 无序,不重复. Redis操作中,涉及到两个大数据集合的并集,交集,差集运算. 赋值: l sadd key values[value1.v ...
- mongodb 关闭服务器
./mongo use admin db.shutdownServer() 啦啦啦
- flexbox常用布局左右固定,中间自适应
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...