Linux6上安装MySQL
MySQL安装包下载:https://www.mysql.com/downloads/

然后选择:


把下载好的安装包传到服务器上的指定目录,然后解压:
[root@master mysql]# tar -xvf mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar
mysql-community-test-5.7.24-1.el6.x86_64.rpm
mysql-community-client-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-5.7.24-1.el6.x86_64.rpm
mysql-community-server-5.7.24-1.el6.x86_64.rpm
mysql-community-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-common-5.7.24-1.el6.x86_64.rpm
查询有没有安装MySQL:
rpm -qa | grep mysql
如果安装,则卸载:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
安装下面的顺序进行安装:
rpm -ivh mysql-community-common-5.7.24-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.24-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.24-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.24-1.el6.x86_64.rpm
然后启动:
service mysqld start
查看报错日志:
grep 'temporary password' /var/log/mysqld.log
2019-01-04T18:41:22.901300Z 1 [Note] A temporary password is generated for root@localhost: wsOk8mlgky*.
mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ps -A | grep -i mysql
查看状态:
/etc/rc.d/init.d/mysqld status
mysqld is stopped
重启:
service mysqld start
Starting mysqld: [ OK ]
再次查看:
/etc/rc.d/init.d/mysqld status
mysqld (pid 2748) is running...
进入MySQL:
mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
报错:
修改:vim /etc/my.cnf
添加:
[mysqld]
skip-grant-tables
重新启动:/etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
/usr/bin/mysqld_safe: line 517: cd: /root/mysql/mysql5.7: Not a directory
Starting mysqld: [ OK ]
[root@master mysql5.7]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>
mysql> update user set authentication_string=password("mysql") where User='root'; --更新一下密码
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
重新启动:
[root@master mysql5.7]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
/usr/bin/mysqld_safe: line 517: cd: /root/mysql/mysql5.7: Not a directory
Starting mysqld: [ OK ]
[root@master mysql5.7]# mysql -u root -p
Enter password:
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
可以看到中间有个报错:
/usr/bin/mysqld_safe: line 517: cd: /root/mysql/mysql5.7: Not a directory
解决办法:
chmod -R 755 /root
[root@master /]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
完美解决。
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by 'mysql';
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>
至此,MySQL安装成功。
Linux6上安装MySQL的更多相关文章
- Ubuntu上安装MySql过程,以及遇到的一些问题
今天在Ubuntu服务器上安装MySql的时候遇到了一些问题,记录下来,以防以后忘记. 安装环境:Ubuntu14.04 安装命令: //安装Mysal服务端//会提示输入root密码 sudo ap ...
- ubuntu上安装mysql 编译安装
为什么要折腾?首先说明的是ubuntu上安装mysql等软件是非常容易简单的,其简单的程度盖过windows上的安装,一句sudo apt-get install就可以搞定.如果想用最简便的方法安装m ...
- 在linux(CentOS-6.7_x86_64)上安装mysql成功记录
查看linux服务器的yum源设置: [root@hadoop03 yum.repos.d]# cd /etc/yum.repos.d [root@hadoop03 yum.repos.d]# ll ...
- 阿里云服务器上安装mysql的心路历程(博友们进来看看哦)
在阿里云花了100买了一台云服务器,配置如下: CPU: 1核 内存: 512MB 数据盘: 0G 带宽: 1Mbps 阿里云服务器安装mysql搞得我想吐血,搞了一个多星期,现在才搞好,而且,还有许 ...
- 在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)
这篇文章简述了在Mac OSX狮子(Lion)上安装MySQL Community Server最新版本v10.6.7的过程. MySQL是最流行的开源数据库管理系统.首先,从MySQL的下载页面上下 ...
- 在Windows上安装MySQL(免安装ZIP版)
在 Windows 上安装MySQL(免安装ZIP版) 因为一些原因,重新安装了MySQL数据库,重装时习惯性使用最新版下载 此过程中发现MySQL 5.7.12 和MySQL 5.6的安装有些区别: ...
- 记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb
记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb 前段时间我个人Google服务器意外不能用,并且我犯了一件很低级的错误,直接在gcp讲服 ...
- 在Linux机器上安装MySQL
在Linux机器上安装MySQL,仔细认真些就没有问题. CentOS 7下MySQL 5.7安装.配置与应用_数据库技术_Linux公社-Linux系统门户网站 搞不定的话,直接删掉这个MySQL, ...
- Ubuntu 12.04上安装MySQL并运行
Ubuntu 12.04上安装MySQL并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 安装MySQL数据库 sudo apt-get upda ...
随机推荐
- [常用的Cmd运行命令]
打开命令提示符,有很多与系统有关的命令都可以在命令提示符中完成,比如输入ipconfig查看电脑的IP osk 打开屏幕键盘 calc 打开计算器的功能 notepad 打开记事本 mspaint ...
- tensorflow二进制文件读取与tfrecords文件读取
1.知识点 """ TFRecords介绍: TFRecords是Tensorflow设计的一种内置文件格式,是一种二进制文件,它能更好的利用内存, 更方便复制和移动,为 ...
- 阶段3 3.SpringMVC·_03.SpringMVC常用注解_2 RequestBody注解
拿整个请求体的数据
- iOS检测用户截屏, 并获取所截图片
// // ViewController.m // CheckScreenshotDemo // // Created by 思 彭 on 2017/4/25. // Copyright © 2017 ...
- k8s设置集群角色
查看所有的node节点 [root@test1 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION test1 Ready <none> ...
- Day6 && Day7图论
并查集 A - How Many Answers Are Wrong 题意:已知区间[1,n],给出m组数据,即[l,r]区间内数据之和为s,求错误数据的数量. 拿到这道题,真的没思路,知道用并查集, ...
- 让nginx 的ssi支持include相对路径
好久没接触nginx了,今天帮同事解决一个客户的问题,顺便记录下:version : nginx-1.6.2问题描述:客户的files.shtml里面include一个网站的头部文件( <!–# ...
- python基础知识(保留字和标识符、变量、常量、基本数据类型)
保留字 保留字是python语言中已经被赋予特定意义的一些单词,开发程序时,不可以作为变量.函数.类.模块和其他对象的名称来使用例如:import 关键字输入后会变色 通过代码进行查看 import ...
- C#编程 Excel操作
使用OLEDB操作Excel,关于OLEDB介绍参考http://www.cnblogs.com/moss_tan_jun/archive/2012/07/28/2612889.html 连接字符串: ...
- 2 基于梯度的攻击——PGD
PGD攻击原论文地址——https://arxiv.org/pdf/1706.06083.pdf 1.PGD攻击的原理 PGD(Project Gradient Descent)攻击是一种迭代攻击,可 ...