centos7 + mysql5.7 tar包解压安装
#卸载系统自带的Mariadb
[root@hdp265dnsnfs ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.-.el7.centos.x86_64
[root@hdp265dnsnfs ~]# rpm -e --nodeps mariadb-libs-5.5.-.el7.centos.x86_64 #删除etc目录下的my.cnf文件 [root@hdp265dnsnfs ~]# rm /etc/my.cnf
rm: cannot remove ?etc/my.cnf? No such file or directory #检查mysql是否存在
[root@hdp265dnsnfs ~]# rpm -qa | grep mysql
[root@hdp265dnsnfs ~]# #检查mysql组和用户是否存在,如无创建
[root@hdp265dnsnfs ~]# cat /etc/group | grep mysql
[root@hdp265dnsnfs ~]# cat /etc/passwd | grep mysql #创建mysql用户组
[root@hdp265dnsnfs ~]# groupadd mysql
#创建一个用户名为mysql的用户并加入mysql用户组
[root@hdp265dnsnfs ~]# useradd -g mysql mysql
#制定password 为111111
[root@hdp265dnsnfs ~]# passwd mysql
Changing password for user mysql.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully. #由于我的/usr/local空间不足,所以我安装到/var
[root@hdp265dnsnfs var]# tar -zxvf mysql-5.7.-linux-glibc2.-x86_64.tar.gz
[root@hdp265dnsnfs var]# mv mysql-5.7.-linux-glibc2.-x86_64/ mysql57 #更改所属的组和用户
[root@hdp265dnsnfs var]# chown -R mysql mysql57/
[root@hdp265dnsnfs var]# chgrp -R mysql mysql57/
[root@hdp265dnsnfs var]# cd mysql57/ [root@hdp265dnsnfs mysql57]# mkdir data [root@hdp265dnsnfs mysql57]# chown -R mysql:mysql data
在etc下新建配置文件my.cnf,并在该文件内添加以下配置
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
skip-name-resolve
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=/var/mysql57
# 设置mysql数据库的数据的存放目录
datadir=/var/mysql57/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M
安装和初始化
[root@hdp265dnsnfs mysql57]# bin/mysql_install_db --user=mysql --basedir=/var/mysql57/ --datadir=/var/mysql57/data/
-- :: [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
-- :: [WARNING] The bootstrap log isn't empty:
-- :: [WARNING] --17T09::.728710Z [Warning] --bootstrap is deprecated. Please consider using --initialize instead
--17T09::.729161Z [Warning] Changed limits: max_open_files: (requested )
--17T09::.729167Z [Warning] Changed limits: table_open_cache: (requested )
[root@hdp265dnsnfs mysql57]# cp ./support-files/mysql.server /etc/init.d/mysqld
[root@hdp265dnsnfs mysql57]# chown /etc/my.cnf
[root@hdp265dnsnfs mysql57]# chmod +x /etc/init.d/mysqld
[root@hdp265dnsnfs mysql57]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS! #设置开机启动 [root@hdp265dnsnfs mysql57]# chkconfig --level mysqld on
[root@hdp265dnsnfs mysql57]# chkconfig --list mysqld [root@hdp265dnsnfs mysql57]# chmod +x /etc/rc.d/init.d/mysqld
[root@hdp265dnsnfs mysql57]# chkconfig --add mysqld
[root@hdp265dnsnfs mysql57]# chkconfig --list mysqld
[root@hdp265dnsnfs mysql57]# service mysqld status
SUCCESS! MySQL running ()
etc/profile/
export PATH=$PATH:/var/mysql57/bin [root@hdp265dnsnfs mysql57]# source /etc/profile
获得初始密码
[root@hdp265dnsnfs bin]# cat /root/.mysql_secret
# Password set for user 'root@localhost' at -- ::
_pB*3VZl5T<
修改密码
[root@hdp265dnsnfs bin]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. 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
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> set PASSWORD = PASSWORD('');
Query OK, rows affected, warning (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.01 sec)
添加远程访问权限
mysql> use mysql
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> update user set host='%' where user='root';
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> select host,user from user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | root |
| localhost | mysql.sys |
+-----------+-----------+
rows in set (0.00 sec) create user 'xxx'@'%' identified by '123'; 这里 @‘%’ 表示在任何主机都可以登录
重启生效
/bin/systemctl restart mysql.service [root@hdp265dnsnfs bin]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
为了在任何目录下可以登录mysql
ln -s /var/mysql57/bin/mysql /usr/bin/mysql
centos7 + mysql5.7 tar包解压安装的更多相关文章
- 通过tar包解压安装docker
以下步骤在centos7和debian10中验证通过 1.通过官网下载安装包 wget https://download.docker.com/linux/static/stable/x86_64/d ...
- tar包解压后用户名改变
最近开发项目时在PC上wang用户及组下打包的tar包解压到嵌入式设备root用户下,文件目录及文件用户名改为dbus和dbus组,导致cron等应用异常. 出现此问题时可以通过修改相应文件(件)的用 ...
- mysql5.7.12直接解压zip包,安装过程
MySQL-5.7.12-winx64.zip解压安装方式 1.解压文件到你想要安装的位置. 本人是直接解压到E盘. 2.配置环境变量,在path中放入:E:\mysql-5.7.12-win ...
- linux 安装mysql数据库——tar.gz包解压安装法
mysql数据库有多种安装方式,本文只介绍在Linux服务器上的tar.gz包解压安装法, 先通过mysql官网或者网络资源下载 mysql-5.7.3-m13-linux-glibc2.5-x86_ ...
- linux下如何打包压缩?解包解压?.tar文件.gz文件
===文件打包.压缩 ==打包 tar [root@521478.com]# tar -cvf etc1.tar /etc //c创建 v详细 f打包后文件名 [root@521478.com]# t ...
- MySQL5.7.25(解压版)Windows下详细的安装过程
大家好,我是浅墨竹染,以下是MySQL5.7.25(解压版)Windows下详细的安装过程 1.首先下载MySQL 推荐去官网上下载MySQL,如果不想找,那么下面就是: Windows32位地址:点 ...
- Linux(CentOS-7) 下载 解压 安装 redis 操作的一些基本命令
使用xshell 连接到虚拟机,并且创建 一个redis目录:创建文件命令:mkdir 文件名ls:查看当前文件里面的所有文件 使用xftp 将下载的linux版本 reids上传动新建的redis目 ...
- Windows下安装zip包解压版mysql
Windows下安装zip包解压版mysql 虽然官方提供了非常好的安装文件,但是有的时候不想每次再重装系统之后都要安装一遍MySQL,需要使用zip包版本的MySQL.在安装时需如下三步: 1. 新 ...
- mysql5.5.x.zip 解压版安装教程
一,前言 记一次安装解压版的mysql 5.5的经过,参考了一些文章,也遇到了一些错误,最终都安装成功了.在这里记录一下安装的过程,一方面自己做一个记录,领一方面给大家提供一份参考. 二,环境 1,w ...
随机推荐
- 访问GitLab的PostgreSQL数据库-(3)
1.登陆gitlab的安装服务查看配置文件 cat /var/opt/gitlab/gitlab-rails/etc/database.yml production: adapter: postgre ...
- MyEclipse中jquery.js文件报missing semicolon的错误解决
myeclipse的验证问题不影响jquery的应用,如果看着别扭,解决办法如下:选中你想去掉的js文件:右键选择 MyEclipse-->Exclude From Validation :然后 ...
- 3.cassandra遇到内存占用过高的问题
目前cssandra的内存分配如下: https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_tune_jvm_c.ht ...
- 使用navicat mysql 远程连接数据库
远程连接数据库,假设两台主机上都有navicat 客户端 远程主机A ip地址:192.168.100.91 ,port 3306,数据库用户名 rootA 密码 123456A 本地主 ...
- mysql 用户授权命令
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_root_password' WITH GRANT OP ...
- openssl version 查看openssl 版本出现openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory,怎么办
查看openssl版本, 解决办法: ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1 ln -s /usr/local/li ...
- Android APP安装后不在桌面显示图标的应用场景举例和实现方法
最近在为公司做一款车联网的产品,由于公司本身擅长于汽车解码器的研发,所以该产品的诊断功能的实现除了使用目前市面上车联网产品中大量使用的OBD协议外,还会使用一些专车专用协议去实现一些特殊的诊断功能,如 ...
- python接口自动化-token参数关联登录(二)
原文地址https://www.cnblogs.com/yoyoketang/p/9098096.html 原文地址https://www.cnblogs.com/yoyoketang/p/68866 ...
- XDU1024简单逆序对(贪心||分治)
题目描述 逆序对问题对于大家来说已经是非常熟悉的问题了,就是求i<j时,a[i] > a[j]的组数.现在请你求出一串数字中的逆序对的个数,需要注意的是,这些数字均在[0,9]之内. 输入 ...
- 55. Jump Game(贪心)
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...