考虑到很多孩子不会Linux或Mysql,所以我这里提示一下,

这篇教程里 "有多行代码" 的是给你展示结果的,不用你敲

只有一行的才是要你自己敲进去的.

 

1.首先更新一下仓库

sudo apt-get update
2.安装mysql sudo apt-get install -y mysql-server mysql-client
3.检查mysql是否已运行 sudo netstat -tap | grep mysql
有显示就是已运行 4.查询默认的用户名和密码 (提示:sudo命令会让你输入你的用户密码,就是你的开机密码,并且你输入的时候看不到自己输入的内容,不要以为电脑卡住了,输完回车就行) sudo cat /etc/mysql/debian.cnf
显示出来的内容格式如下(我的密码,跟你不一样) baiguo@baiguo-PC:~$ sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = F64nKZ233QkzL8v9
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = F64nKZ233QkzL8v9
socket = /var/run/mysqld/mysqld.sock
其中user代表的用户名,password代表的默认生成的密码 5.利用默认账号密码登录(-p后面是我的密码,你们要把自己的密码放在那里,并且-p跟密码之间无空格) mysql -u debian-sys-maint -pF64nKZ233QkzL8v9
成功进入mysql,有如下显示: baiguo@baiguo-PC:~$ mysql -u debian-sys-maint -pF64nKZ233QkzL8v9
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.21-1 (Debian) 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>
6.现在更改密码的设置.(原封不动复制过去,漏一个字你就完了),这是最重要的部分,很多教程都没有这个,所以才不管用
update mysql.user set plugin="mysql_native_password" where user="root";
成功后结果如下: mysql> update mysql.user set plugin="mysql_native_password" where user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0 mysql>
7.设置root的密码 update mysql.user set authentication_string=password('这里是你的密码') where user='root'and Host = 'localhost';
密码自己设置 8.退出数据库 exit
9.重新启动数据库 sudo service mysql restart
10.用自己设置好的密码登录 mysql -u root -p
输入密码,成功登录,如下. baiguo@baiguo-PC:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.21-1 (Debian) 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> nice!
---------------------

linux 部署之路 修行不够全靠悟的更多相关文章

  1. linux部署django项目流程(全)

    1.python3和python2共存配置 流程在下面网址中 https://www.cnblogs.com/vinic-xxm/p/11358894.html 2.安装依赖包 yum install ...

  2. Linux 部署ASP.NET SQLite 应用 的坎坷之旅 附demo及源码

    Linux 部署ASP.NET SQLite 应用 的坎坷之旅.文章底部 附示例代码. 有一台闲置的Linux VPS,尝试着部署一下.NET 程序,结果就踏上了坑之路,不过最后算是完美解决问题,遂记 ...

  3. .NET持续集成与自动化部署之路第一篇——半天搭建你的Jenkins持续集成与自动化部署系统

    .NET持续集成与自动化部署之路第一篇(半天搭建你的Jenkins持续集成与自动化部署系统) 前言     相信每一位程序员都经历过深夜加班上线的痛苦!而作为一个加班上线如家常便饭的码农,更是深感其痛 ...

  4. Linux系统之路——如何在服务器用U盘安装CentOS7.2(二)

    Linux系统之路——如何在服务器用U盘安装CentOS7.2(一) 说明: 截止目前CentOS 7.x最新版本为CentOS 7.2.1511,下面介绍CentOS 7.2.1511的具体安装配置 ...

  5. Linux下搭建tomcat集群全记录

    (转) Linux下搭建tomcat集群全记录 2011-10-12 10:23 6133人阅读 评论(1) 收藏 举报 tomcatlinuxapacheinterceptorsession集群 1 ...

  6. Linux随笔-鸟哥Linux基础篇学习总结(全)

    Linux随笔-鸟哥Linux基础篇学习总结(全) 修改Linux系统语系:LANG-en_US,如果我们想让系统默认的语系变成英文的话我们可以修改系统配置文件:/etc/sysconfig/i18n ...

  7. Linux学习之路-Linux-at及cron命令【7】---20171215

    Linux学习之路-Linux-at及cron命令[7]---20171215 DannyExia000人评论986人阅读2017-12-24 17:28:03   ntpdate 命令 [root@ ...

  8. Linux上天之路系列目录

    Linux上天之路系列目录 Linux上天之路(一)之Linux前世今生 Linux上天之路(二)之Linux安装 Linux上天之路(三)之Linux系统目录 Linux上天之路(四)之Linux界 ...

  9. linux常用命令与实例小全

    转至:https://www.cnblogs.com/xieguohui/p/8296864.html  linux常用命令与实例小全 阅读目录(Content) 引言 一.安装和登录 (一)    ...

随机推荐

  1. 使用scp上传和下载文件

    利用scp传输文件 1.从服务器下载文件 scp username@servername:/path/filename /tmp/local_destination 例如scp codinglog@1 ...

  2. canal入门Demo

    关于canal具体的原理,以及应用场景,可以参考开发文档:https://github.com/alibaba/canal 下面给出canal的入门Demo (一)部署canal服务器 可以参考官方文 ...

  3. 导出函数__declspec(dllexport)

    一般而言,动态链接库中定义有两种函数:导出函数(export function)和内部函数(internal function). 导出函数可以被其它模块调用,内部函数在定义它们的DLL程序内部使用. ...

  4. SQL - 数据查询

    数据查询是数据库的核心操作.SQL 提供了 select 语句进行数据查询,该语句的一般格式为: select  [ ALL | distinct ] <目标列表达式>  [ ,<目 ...

  5. [转]java异常中Exception捕获不到的异常

    一 概念 众所周知java提供了丰富的异常类,这些异常类之间有严格的集成关系,分类为 父类Throwable Throwable的两个子类Error和Exception Exception的两个子类C ...

  6. 创建含有多module的springboot工程(八)

    创建根工程 创建一个maven 工程,其pom文件为: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?xml version="1.0" enc ...

  7. composer install Your requirements could not be resolved to an installable set of packages

    composer install --ignore-platform-reqs 或者 composer update --ignore-platform-reqs

  8. 学习笔记-AngularJs(五)

    之前的页面太丑了,后来我引入了bootstrap.css,把样式进行修了一番,如下图(一不小心,插入个链接,忽略,http://t.cn/RUbL4rP): (链接:http://www.live08 ...

  9. POJ 1936 All in All 匹配, 水题 难度:0

    题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...

  10. day4-python基础-运算符

    本章节主要说明Python的运算符.举个简单的例子 4 +5 = 9 . 例子中,4 和 5 被称为操作数,"+" 称为运算符. Python语言支持以下类型的运算符: 算术运算符 ...