一、安装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. Modbus转PROFINET网关助力电子天平与西门子PLC无缝对接

    背景: 在制药.食品科学和其他行业中,电子天平被广泛用于质量控制和分析实验.它们可以用于检测样品的净重.含量和浓度,并用于监测产品的制造过程. 常州某反应器公司实验室近期采购一批电子天平,现需要把电子 ...

  2. 平稳扩展:可支持RevenueCat每日12亿次API请求的缓存

    平稳扩展:可支持RevenueCat每日12亿次API请求的缓存 目录 平稳扩展:可支持RevenueCat每日12亿次API请求的缓存 低延迟 建立连接池 故障检测 Up and warm 对故障做 ...

  3. 31. 干货系列从零用Rust编写正反向代理,HTTP限流的实现(limit_req)

    wmproxy wmproxy已用Rust实现http/https代理, socks5代理, 反向代理, 静态文件服务器,四层TCP/UDP转发,七层负载均衡,内网穿透,后续将实现websocket代 ...

  4. [CF1844G] Tree Weights

    题目描述 You are given a tree with $ n $ nodes labelled $ 1,2,\dots,n $ . The $ i $ -th edge connects no ...

  5. 如何将 performance_schema 中的 TIMER 字段转换为日期时间

    问题 最近有好几个朋友问,如何将 performance_schema.events_statements_xxx 中的 TIMER 字段(主要是TIMER_START和TIMER_END)转换为日期 ...

  6. 使用Visual Studio 2022 创建lib和dll并使用

    对于一个经常写javaWeb的人来说,使用Visual Studio似乎没什么必要,但是对于使用ffi的人来说,使用c或c++编译器,似乎是必不可少的,下面我将讲述如何用Visual Studio 2 ...

  7. mysql 定时 数据库备份并上传到另一台服务器上,上传结束并删除源文件

    首先总共有两个脚本: #!/bin/bash:主要用于进行数据库备份.压缩.删除,单独运行命令是:bash  XXX.sh #!/usr/bin/expect:主要用于进行数据备份文件的上传,单独运行 ...

  8. python tkinter 使用(六)

    python tkinter 使用(六) 本文主要讲述tkinter中进度条的使用. 1:确定的进度条 progressbar = tkinter.ttk.Progressbar(root, mode ...

  9. WebView中的页面调试方法

    在 iOS 12 中,苹果正式弃用 UIWebView,改成 WKWebView,参考官方声明. 后者在性能.稳定性.功能方面有很大提升,并且与 Safari 具有相同的 JavaScript 引擎( ...

  10. ElasticSearch之Get index API

    获取指定索引的基本信息. 命令样例如下: curl -X GET "https://localhost:9200/testindex_001?pretty" --cacert $E ...