考虑到很多孩子不会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. IntelliJ Idea设置单击打开文件或者双击打开文件、自动定位文件所在的位置

  2. MySQL 分页查询和存储过程

    一.分页查询 使用limit函数,limit关键字的用法: LIMIT [offset,] rows: offset指定要返回的第一行的偏移量,rows第二个指定返回行的最大数目.初始行的偏移量是0( ...

  3. php多线程代码

    <?php$thNum = 20; //20个进程$total = 20000;//总数$pageNum=100;//每个页面显示100条数据 $pageCount = ceil($total/ ...

  4. php并发

    bool flock ( int handle, int operation [, int &wouldblock] );flock() 操作的 handle 必须是一个已经打开的文件指针.o ...

  5. Spring注解之@Import

    /** * Indicates one or more {@link Configuration @Configuration} classes to import. * 表示import 一个或多个 ...

  6. Linux下的Nginx的配置+Tomcat启动

    Linux下的Nginx的配置 首次如果你只仅主机模式,那么请你切换到桥接模式或者net模式. 1.安装编译工具及库文件 yum -y install make zlib zlib-devel gcc ...

  7. Qt Widgets——抽象按钮及其继承类

    QAbstractButton是有关“按钮”的基类 描述了一个按钮应该具有的组成.它的公有函数如下: QAbstractButton(QWidget * parent = ) ~QAbstractBu ...

  8. Qt一步一步实现插件通信(附源码)

      前一章已经实现了主程序调用加载插件功能,这一章描述主程序和插件间通信功能 说道Qt的通信必须要了解信号和槽的机制原理,这里不做论述,不清楚的同学去看看信号和槽机制 不废话直接上步骤,在上一章的基础 ...

  9. forget suffix word aby able ability out 1

      1★ aby 2★ ability 3★ able   有`~ 能力 的,具有 这样的能力 的人或物  

  10. Easy and cheap cluster building on AWS backup

    https://grapeot.me/easy-and-cheap-cluster-building-on-aws.html Thu 17 July 2014 , by Yan Wang | 2 Co ...