今天在树莓派之中安装mysql,结果被我安装了mariadb,这样做很讨厌,但是也可以将就用。记录一下折腾的过程。

安装就还是使用sudo apt install mysql

1.安装之后需要使用工具进行一些简单的配置

  1. sudo mysql_secure_installation

下面是配置的一个记录,抄别人的

  1. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
  2. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  3.  
  4. In order to log into MySQL to secure it, we'll need the current
  5. password for the root user. If you've just installed MySQL, and
  6. you haven't set the root password yet, the password will be blank,
  7. so you should just press enter here.
  8.  
  9. Enter current password for root (enter for none): <–使用刚才得到的root的密码 NljqL63OYlGo5cqy
  10. OK, successfully used password, moving on...
  11.  
  12. Setting the root password ensures that nobody can log into the MySQL
  13. root user without the proper authorisation.
  14.  
  15. You already have a root password set, so you can safely answer 'n'.
  16.  
  17. Change the root password? [Y/n] y <– 是否更换root用户密码,输入y并回车,强烈建议更换
  18. New password: <– 设置root用户的密码
  19. Re-enter new password: <– 再输入一次你设置的密码
  20. Password updated successfully!
  21. Reloading privilege tables..
  22. ... Success!
  23.  
  24. By default, a MySQL installation has an anonymous user, allowing anyone
  25. to log into MySQL without having to have a user account created for
  26. them. This is intended only for testing, and to make the installation
  27. go a bit smoother. You should remove them before moving into a
  28. production environment.
  29.  
  30. Remove anonymous users? [Y/n] y <– 是否删除匿名用户,生产环境建议删除,所以输入y并回车
  31. ... Success!
  32.  
  33. Normally, root should only be allowed to connect from 'localhost'. This
  34. ensures that someone cannot guess at the root password from the network.
  35.  
  36. Disallow root login remotely? [Y/n] y <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
  37. ... Success!
  38.  
  39. By default, MySQL comes with a database named 'test' that anyone can
  40. access. This is also intended only for testing, and should be removed
  41. before moving into a production environment.
  42.  
  43. Remove test database and access to it? [Y/n] y <– 是否删除test数据库,输入y并回车
  44. - Dropping test database...
  45. ... Success!
  46. - Removing privileges on test database...
  47. ... Success!
  48.  
  49. Reloading the privilege tables will ensure that all changes made so far
  50. will take effect immediately.
  51.  
  52. Reload privilege tables now? [Y/n] y 是否重新加载权限表,输入y并回车
  53. ... Success!
  54.  
  55. All done! If you've completed all of the above steps, your MySQL
  56. installation should now be secure.
  57.  
  58. Thanks for using MySQL!
  59.  
  60. Cleaning up...

2.修改 /etc/mysql/mariadb.conf.d/50-server.cnf 文件

设置正确的时区

  1. [mysqld]
  2. default-time-zone = '+8:00'

设置可远程访问,设置之后3306端口就开放了

  1. #bind-address = 127.0.0.1

之后在终端里输入

  1. GRANT ALL PRIVILEGES ON *.* TO '需要开放的用户的用户名'@'需开放的地址' IDENTIFIED BY '用户密码' WITH GRANT OPTION;
  1. flush privileges;

之后select表的时候就应该可以看到,多了一个用户,用此用户即可远程登录。当然,在此之前还是需要重启mysql服务器的。

sodo service mysql restart

备忘一下,mysql之中看所有数据库的命令是show databases,而不是show dbs,和mongodb不一样

树莓派mariadb折腾的更多相关文章

  1. 树莓派 Raspberry-Pi 折腾系列:系统安装及一些必要的配置

    入手树莓派将近一个月了,很折腾,许多资源不好找,也很乱.简单整理一下自己用到的东西,方便以后自己或别人继续折腾. 0. 操作系统下载 树莓派官方 Raspbian 系统下载:http://www.ra ...

  2. 【树莓派】【转载】Raspberry Pi (树莓派)折腾记

    在网上看到一篇对树莓派折腾记录比较详细的文章,时间比较早,但是有些东西没变. 对于新手而言,还是有点参考价值.文章参见:http://skypegnu1.blog.51cto.com/8991766/ ...

  3. 树莓派3b折腾指南

    最近入手了树梅派3b,搭建了宿舍共享的热点和NAS,搭建透明代理科学上网的计划还没实现. 先报个价,一套折腾下来花了500大洋,树梅派3加外壳200,电源加内存卡100,显示器淘宝二手150,有线键鼠 ...

  4. 树莓派mariadb 设置密码

    参考: sudo mysql -u root -p select Host,User,plugin from mysql.user where User='root'; plugin(加密方式)是un ...

  5. RPi 2B Raspbian system install

    /***************************************************************************** * RPi 2B Raspbian系统安装 ...

  6. windows ssh RPi 2B

    /************************************************************************* * windows ssh RPi 2B * 声明 ...

  7. 使用MMS(MongoDB Monitoring Service)监控MongoDB

    使用MMS(MongoDB Monitoring Service)监控MongoDB 一.MongoDB简介: MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可 ...

  8. 在树莓派上配置MariaDB

    在树莓派上配置MariaDB 前言 MariaDB是由原本开发MySQL的一些原始开发者领导,他们担心Oracle收购MySQL后会有一些隐患.MariaDB与MySQL保持这高度兼容性,并使用了一个 ...

  9. 树莓派安装配置Nginx+PHP7+MariaDB

    原文地址:http://blog.sina.com.cn/s/blog_150f554f50102yhra.html 一.安装 Nginx 和 PHP7 1.安装Nginx sudo apt inst ...

随机推荐

  1. Visual Studio上编译ncnn

    prerequisite 是为了在PC上熟悉ncnn的基本代码,所以用Visual Studio来配置的. 期间用过VS2013(update5)/VS2015/VS2017,反正都是基于CMake生 ...

  2. C++11 中的function和bind、lambda用法

    std::function 1. std::bind绑定一个成员函数 #include <iostream> #include <functional> struct Foo ...

  3. 深入理解JSCore

    https://blog.csdn.net/MeituanTech/article/details/82108667

  4. 一脸懵逼学习Hadoop-HA机制(以及HA机制的配置文件,测试)

    1:能否让两个NameNode都正常影响客户端请求? 应该让两个NameNode节点在某个时间只能有一个节点正常影响客户端请求,相应请求的必须为Active状态的那一台. 2:standBy状态的节点 ...

  5. [转] JavaScript 之 ArrayBuffer

    JS里的ArrayBuffer 还记得某个晚上在做 canvas 像素级操作,发现存储像素的数据格式并不是Array类型,而是ArrayBuffer,心想这是什么鬼?后来查了一些资料,发现自己这半年来 ...

  6. vue-all

    http://v1-cn.vuejs.org/guide/ [1]. vue-cli [项目不完整,跳过]https://github.com/vuejs/vue-cli vue-cli-master ...

  7. 使用 curses 函数库管理基于文本的屏幕

    curses 函数库提供了终端无关的方式来编写全屏幕的基于字符的程序.curses 还可以管理键盘,提供了一种简单易用的非阻塞字符输入模式. curses 函数库能够优化光标的移动并最小化需要对屏幕进 ...

  8. 一起学Hadoop——文件的上传、分发与打包

    如果我们想把文件上传到Hadoop集群中,使用put命令即可.下面的语句是将本地文件上传到hadoop集群的/目录下. hadoop fs -put fruit.txt /   下面介绍通过脚本将文件 ...

  9. ionic2中使用moment.js

    安装 npm i moment --save 使用 import { Pipe, PipeTransform } from '@angular/core'; import Moment from 'm ...

  10. linux下在root用户登陆状态下,以指定用户运行脚本程序实现方式

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMcAAABKCAIAAACASdeXAAAEoUlEQVR4nO2dy7WlIBBFTYIoSIIkmD ...