RedHat7上安装MySQL5.7.16
[root@chenguo etc]# rpm -qa|grep -i mysql
[root@chenguo ~]# groupadd mysql
[root@chenguo ~]# useradd -r -g mysql -p root mysql
[chenguo@chenguo ~]$ cd /usr/local/
[chenguo@chenguo local]$ tar -xvf mysql-5.7.-.el7.x86_64.rpm-bundle.tar
mysql-community-libs-compat-5.7.-.el7.x86_64.rpm
mysql-community-devel-5.7.-.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.-.el7.x86_64.rpm
mysql-community-libs-5.7.-.el7.x86_64.rpm
mysql-community-common-5.7.-.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.-.el7.x86_64.rpm
mysql-community-test-5.7.-.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.-.el7.x86_64.rpm
mysql-community-server-minimal-5.7.-.el7.x86_64.rpm
mysql-community-server-5.7.-.el7.x86_64.rpm
mysql-community-client-5.7.-.el7.x86_64.rpm
mysql-community-embedded-5.7.-.el7.x86_64.rpm
[chenguo@chenguo local]$ rpm -qa|grep mariadb
mariadb-libs-5.5.-.el7_0.x86_64
[chenguo@chenguo local]$ su -
[root@chenguo ~]# rpm -e mariadb-libs-5.5.-.el7_0.x86_64 --nodeps
[root@chenguo ~]# rpm -e --nodeps mariadb-libs-5.5.-.el7_0.x86_64
[root@chenguo lib]# su -chenguo
[chenguo@chenguo lib]$ cd /usr/local/
[chenguo@chenguo local]$ rpm -ivh mysql-community-common-5.7.-.el7.x86_64.rpm
warning: mysql-community-common-5.7.-.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
[chenguo@chenguo local]$ su -
[root@chenguo local]# rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.16-1.e################################# [100%]
[root@chenguo local]# rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.16-1.el7################################# [100%]
[root@chenguo local]# rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.16-1.er################################# [100%])
[root@chenguo local]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.16-1.e################################# [100%]
[root@chenguo bin]# cd /usr/local/bin
[root@chenguo bin]# mysqld --initialize --user=mysql
[root@chenguo bin]# mysqld --initialize-insecure --user=mysql
--18T08::.910921Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--18T08::.912342Z [ERROR] --initialize specified but the data directory has files in it. Aborting.
--18T08::.912368Z [ERROR] Aborting
[root@chenguo bin]# cd /var/lib
[root@chenguo lib]# rm -rf mysql
[root@chenguo local]# cd /usr/local/bin/
[root@chenguo bin]# mysqld --initialize-insecure --user=mysql
[root@chenguo lib]# systemctl start mysqld
Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.
[root@chenguo lib]# ls -ld /var/lib/mysql-files
[root@chenguo lib]# mkdir /var/lib/mysql-files
[root@chenguo lib]# systemctl start mysqld
[root@chenguo lib]# chown -R mysql:mysql /var/lib/mysql
[root@chenguo ~]# journalctl |grep mysql
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@chenguo ~]# cd /var/log
[root@chenguo log]# cat mysqld.log
--22T02::.860176Z [ERROR] InnoDB: Operating system error number in a file operation.
--22T02::.860231Z [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
--22T02::.860238Z [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
--22T02::.860246Z [ERROR] InnoDB: Plugin initialization aborted with error Generic error
--22T02::.471773Z [ERROR] Plugin 'InnoDB' init function returned error.
--22T02::.471974Z [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
--22T02::.472096Z [ERROR] Failed to initialize plugins.
--22T02::.472245Z [ERROR] Aborting
[root@chenguo bin]# ls -ld /usr/sbin/mysqld
-rwxr-xr-x. root root Sep : /usr/sbin/mysqld
[root@chenguo bin]# chown -R mysql:mysql /usr/sbin/mysqld
[root@chenguo bin]# chown -R root:root /usr/sbin/mysqld
[root@chenguo lib]# systemctl start mysqld
[root@chenguo ~]# mysql
mysql> use mysql;
mysql> select host, user from user;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
mysql> exit
[root@chenguo ~]# mysql
mysql> use mysql;
mysql> select Host,user from user where User='root';
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
rows in set (0.01 sec)
mysql> exit
[root@chenguo ~]# vi /etc/my.cnf
character-set-server=utf8
collation-server=utf8_general_ci
如果要修改其他的属性可以继续添加:
character-set-server=utf8
collation-server=utf8_general_ci
max_connections=
table_open_cache=
thread_cache_size=
open_files_limit=
event_scheduler=ON group_concat_max_len=
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# 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
#
# 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
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8
collation-server=utf8_general_ci
max_connections=
table_open_cache=
thread_cache_size=
open_files_limit=
event_scheduler=ON group_concat_max_len= # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@chenguo ~]# systemctl stop mysqld
[root@chenguo ~]# systemctl restart mysqld
[root@chenguo ~]# mysql
mysql> use mysql
mysql> SHOW VARIABLES LIKE 'event_scheduler';
mysql> SHOW VARIABLES LIKE 'group_concat_max_len';
[root@chenguo ~]# mysql
ERROR (): Access denied for user 'root'@'localhost' (using password: NO)
、命令执行完毕后,mysql就安装完成,下面需要做的就是对mysql 进行初始化
[root@chenguo bin]# cd /usr/local/bin
[root@chenguo bin]# mysqld --initialize --user=mysql
[root@chenguo bin]# mysqld --initialize-insecure --user=mysql
--18T08::.910921Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--18T08::.912342Z [ERROR] --initialize specified but the data directory has files in it. Aborting.
--18T08::.912368Z [ERROR] Aborting
解决办法:
进入/var/lib/目录中查看是否有mysql目录,有的话进行删除:
[root@chenguo bin]# cd /var/lib
[root@chenguo lib]# rm -rf mysql
[root@chenguo local]# cd /usr/local/bin/
[root@chenguo bin]# mysqld --initialize-insecure --user=mysql
[root@chenguo ~]# mysql
mysql> use mysql
mysql> update user set password=PASSWORD('root') where User='root';
ERROR (42S22): Unknown column 'password' in 'field list'
mysql> update user set authentication_string=PASSWORD('root') where User='root';
[root@chenguo ~]# systemctl stop mysqld
[root@chenguo ~]# systemctl restart mysqld
[root@chenguo ~]# mysql -u root -p
Enter password:
RedHat7上安装MySQL5.7.16的更多相关文章
- 在 CentOS7 上安装 MySQL5.7
在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...
- 在centos上安装mysql5.7的三种方法
带OS信息的是已编译的二进制文件,不带OS信息的是源码包 mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz 二进制包 mysql-5.5.51.tar.gz 源码包 ...
- CentOS 6.9上安装mysql-5.6.36
CentOS 6.9上安装mysql-5.6.36 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/data,而后需要创建/da ...
- CentOS6.7上安装Mysql5.7
CentOS6.7上安装Mysql5.7 2017年07月22日 18:27:05 阅读数:564 环境的配置总是令人作呕,所以这次表明版本条件: 首先,这是一台新机器 其次,CentOS版本如下: ...
- 通过xshell在linux上安装mysql5.7(终极版)
通过xshell在linux上安装mysql5.7(终极版) 0)通过xshell连接到远程服务器 1)彻底删除原来安装的mysql 首先查看:rpm -qa|grep -i mysql 删除操作(一 ...
- CentOS 6.9上安装mysql-5.6.37
CentOS 6.9上安装mysql-5.6.37 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/data,而后需要创建/da ...
- CentOS7 离线安装mysql-5.7.16
CentOS7 离线安装mysql-5.7.16 1 . 安装新版mysql前,需将系统自带的mariadb-lib卸载 [root@slave mytmp]# rpm -qa|grep mariad ...
- Win7安装MySQL-5.7.16过程
1.在C盘新建MYSQL文件夹:2.将mysql-5.7.16-winx64拷贝到C:\MYSQL文件夹下,更名为mysql-5.7.16:3.在mysql-5.7.16目录下,建my.ini文件,内 ...
- linux上安装mysql5.6
CentOS-6.6+MySQL-5.6 部署环境操作系统:CentOS-6.6-x86_64-bin-DVD1.isoMySQL 版本:mysql-5.6.26.tar.gz操作用户:root系统 ...
随机推荐
- Python多层目录模块调用
一. 引用模块在 父+级目录中: 1. 将导入模块所在目录(../model/模块)添加到系统环境变量path下,可添加多个 import syssys.path.append("../mo ...
- 简单c语言子集词法分析器
概述 词法分析是编译的第一个环节,其输入是高级语言程序,输出是单词串.词法分析器的主要任务是将高级语言程序作为字符串输入,然后依据词法规则将字符串组合成单词,并输出单词串. 为了方便之后的编译环节,通 ...
- 交作业啊,python爬取58的页面
第一次写博文,好紧张啊,写这么烂怎么给别人看啊先做下总结: 刚开始学习python,自我感觉python写起来确实很方便,各种库,各种语法糖,不过刚接触,一下子记不下来这么多东西,总感觉乱乱的,用的多 ...
- vue+websocket+express+mongodb实战项目(实时聊天)
继上一个项目用vuejs仿网易云音乐(实现听歌以及搜索功能)后,发现上一个项目单纯用vue的model管理十分混乱,然后我去看了看vuex,打算做一个项目练练手,又不想做一个重复的项目,这次我就放弃颜 ...
- bzoj2876 [Noi2012]骑行川藏
Description 蛋蛋非常热衷于挑战自我,今年暑假他准备沿川藏线骑着自行车从成都前往拉萨.川藏线的沿途有着非常美丽的风景,但在这一路上也有着很多的艰难险阻,路况变化多端,而蛋蛋的体力十分有限,因 ...
- 使用jquery的load方法设计动态加载,并解决浏览器前进、后退、刷新等问题
继上一篇 使用jquery的load方法设计动态加载,并解决被加载页面JavaScript失效问题 解决了后台业务系统的部分动态加载问题,然而该框架离正常的用户体验还存在一些问题,如:浏览器的前进.后 ...
- 如何修改dmesg log buffer size
CONFIG_LOG_BUF_SHIFT: Kernel log buffer size (16 => 64KB, 17 => 128KB) General informations Th ...
- linux性能分析及调优
第一节:cpu 性能瓶颈 计算机中,cpu是最重要的一个子系统,负责所有计算任务: 基于摩尔定律的发展,cpu是发展最快的一个硬件,所以瓶颈很少出现在cpu上: 我们线上环境的cpu都是多核的,并且基 ...
- bzoj 3028: 食物 -- 母函数
3028: 食物 Time Limit: 3 Sec Memory Limit: 128 MB Description 明明这次又要出去旅游了,和上次不同的是,他这次要去宇宙探险! 我们暂且不讨论他 ...
- 【openstack N版】——摘除一个计算节点
1.查看计算节点 #查看所有计算节点 [root@open-control01 ~]# nova service-list+----+------------------+-------------- ...