一、安装MySQL

1. 删除Mysql 数据库

sudo apt autoremove --purge mysql-server-*
sudo apt remove mysql-server
sudo apt autoremove mysql-server
sudo apt remove mysql-common

2. 安装Mysql

sudo apt-get update #更新包
sudo apt install mysql-server-5.7

查看 MySQL 版本

sudo mysql -V

查看MySQL默认账号和密码

sudo cat /etc/mysql/debian.cnf

二、配置MySQL

sudo mysql_secure_installation
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N #2
Please set the password for root here...
New password: (输入密码)
Re-enter new password: (重复输入) #3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N #4
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N #5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N #6
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

三、查看mysql服务状态

systemctl status mysql.service

四、修改root账户认证方式

sudo cat /etc/mysql/debian.cnf  # 查看 Password 后面的密码
mysql -u debian-sys-maint -p #进入 mysql 命令模式 mysql> use mysql;
mysql> select user,host,authentication_string from user;
mysql> update mysql.user set authentication_string=password('密码') where user='root' and Host ='localhost';
mysql> update user set plugin='mysql_native_password'; //注意别更新错了,错了客户端工具就连不上了
mysql> select Host, User, plugin from user;
mysql> flush privileges;
mysql> quit; 

五、配置远程访问mysql

修改配置文件,注释掉bind-address = 127.0.0.1

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
:wq mysql -uroot -p mysql> use mysql;
mysql> update user set host='%' where user = 'root';
mysql> flush privileges;

#重启
sudo service mysql restart
#查看状态
systemctl status mysql.service

Ubuntu 安装 MySQL 5.7的更多相关文章

  1. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  2. ubuntu安装mysql后不能远程访问的方法

    ubuntu安装mysql后不能远程访问的方法1.mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassw ...

  3. Ubuntu 安装 Mysql 5.6 数据库

    Ubuntu 安装 Mysql 5.6 数据库 1)下载: mysql-5.6.13-debian6.0-x86_64.deb http://dev.mysql.com/downloads/mirro ...

  4. Ubuntu安装mysql之后,编译找不到头文件

    解决Ubuntu安装mysql之后找不到mysql.h问题   安装: sudo apt-get install libmysqlclient-dev   编译: gcc test.c -o test ...

  5. Linux Deploy Ubuntu安装MySQL

    一.在Android手机安装Linux 二.Ubuntu安装Mysql 建议在root用户上操作 sudo su 输入密码 (一)安装mysql 1. sudo apt-get install mys ...

  6. ubuntu安装mysql<服务器>

    服务器 阿里云服务器Ubuntu安装mysql 2014-08-22 21:52 |  coding云 |  7315次阅读 | 11条评论   这里首先吐槽一下阿里云,我作为公司的唯一懂服务器架设的 ...

  7. ubuntu安装mysql数据库方法

    ubuntu基于linux的免费开源桌面PC操作系统,十分契合英特尔的超极本定位,支持x86.64位和ppc架构.一个比较流行的Linux操作系统,不仅简单易用,而且和Windows相容性非常好.那么 ...

  8. ubuntu安装mysql并使用Navicat连接

    今天配置了一下自己的服务器,发现网上很多教程都有点老,而且不是很全.干脆就写一篇Ubuntu安装mysql,并用Navicat连接的全流程 一.安装mysql 1. sudo apt-get inst ...

  9. Ubuntu 安装mysql和简单操作

    http://www.cnblogs.com/zhuyp1015/p/3561470.html ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get inst ...

  10. Ubuntu安装Mysql+Django+MySQLdb

    安装Mysql sudo apt-get install mysql-server mysql-client root@IdeaPad:/# mysql -u root -p Enter passwo ...

随机推荐

  1. Ubuntu 编辑文件、安装、删除软件等常用命令(持续更新)

    一.编辑文件 1. sudo vi 文件名,进入文件页面,如图: 2. 按 i 键或者 o 键,进入编辑,左下角出现---------INSERT---------信息 3. 输入完毕后,按ESC退出 ...

  2. C/C++ __builtin 超实用位运算函数总结

    以 __builtin 开头的函数,是一种相当神奇的位运算函数,下面本人盘点了一下这些以 __builtin 开头的函数,希望可以帮到大家. 1 __builtin_ctz( ) / __buitli ...

  3. 脚踏esbuild祥云,胸怀tsx利刃,身披scss羽衣,追寻前端的本质

    本文所有内容,纯属个人观点,无意与任何人争论 前端技术的现状 我觉得前端技术发展到现在有两个最主要的特征 前端工具链为前端工程化提供了强有力的支持 这方面主要是webpack.rollup.esbui ...

  4. Android 应用接入 Firebase Crashlytics 进行崩溃分析上报

    前言 所在公司的项目中有一款应用应客户要求,需要接入 Firebase Crashlytics,在此提前练手,也做个总结.本文以最新的 Gradle 7.5 为例,如果 Gradle 版本比较低,添加 ...

  5. Hdu4742 (CDQ分治)

    题意:给出n个三维点对(x,y,z),可随意排列,求三维非严格最长上升子序列长度和最长上升子序列数量. 输入格式:第一行为一整数T表示用例组数,每组用例第一行为一整数n表示点数,之后n行每行三个整数x ...

  6. python操作mongodb基本使用

    使用pymongo,具体可以参考官方文档: 语法上基本和原生mongodb是一样的,所以非常容易入手... https://pymongo.readthedocs.io/en/stable/tutor ...

  7. 操作系统大作业:在Linux环境下模拟实现简单命令解释器(代码部分)

    好家伙   1. 题目要求 一.   课程设计(大作业)目的 熟悉Linux编程环境,加强对Linux命令的理解及函数的运用,完成一个操作系统的部分系统的设计过程.编码.调试,锻炼实际应用能力. 二. ...

  8. 【Python】【OpenCV】绘制外接矩形、外接圆

    外接矩形.外接圆: 1 import cv2 2 import numpy 3 4 img = cv2.imread('../img/img.png', -1) 5 ret, thresh = cv2 ...

  9. Kernel Memory 入门系列:自定义处理流程

    Kernel Memory 入门系列:自定义处理流程 在整个文档预处理的流程中,涉及到很多的处理步骤,例如:文本提取,文本分片,向量化和存储.这些步骤是Kernel Memory中的默认提供的处理方法 ...

  10. MySQL 事务的基础知识

    事务的基础知识 1. 数据库事务概述 事务是数据库区别于文件系统的重要特性之一,当我们有了事务就会让数据库中的数据始终保持 一致性,同时我们还能通过事务的机制 恢复到某个时间地点的数据,这样可以保证已 ...