TianAlchemy

Python、Flask


  • 首页

  • 分类

  • 关于

  • 归档

  • 标签

MySQL workbench Linux下安装记录

发表于 2017-04-23

1.
sudo netstat -tap | grep mysql #确保系统已安装并启动MySQL

2.
sudo apt-get install mysql-workbench #安装mysql-workbench

3.
本地搜索mysql-workbench,创建新的连接

!出现问题,如下:

Cannot Connect to Database Server

Your connection attempt failed for user ‘root’ from your host to server at
127.0.0.1:3306:Can’t connect to mysql server on ‘127.0.0.1’(10061)

Please:

  1. Check that mysql is running on server 127.0.0.1
  2. Check that mysql is running on port 3306 (note: 3306 is the default, but this can
    be changed)
  3. Check the root has rights to connect to 127.0.0.1 from your address (mysql rights
    define what clients can connect to the server and from which machines)
  4. Make sure you are both providing a password if needed and using the correct
    password for 127.0.0.1 connecting from the host address you’re connecting from

百度搜索到 http://stackoverflow.com/questions/7864276/cannot-connect-to-database-server-mysql-workbench 很有帮助,但大多是Windows系统的解决方法,正在逐一尝试。

其他命令:
Linux下查看mysql、apache是否安装,并卸载。

指令 ps -ef|grep mysql 得出结果

root 17659 1 0 2011 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/mysql/mysql.sock –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid
mysql 17719 17659 0 2011 ? 03:14:57 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysqld.pid –skip-external-locking –socket=/var/lib/mysql/mysql.sock
usr/bin/mysql 是指:mysql的运行路径
var/lib/mysql 是指:mysql数据库文件的存放路径
usr/lib/mysql 是指:mysql的安装路径

SSH创建记录

发表于 2017-04-22

因为Hexo博客每次更新push到GitHub上都要输入Git账号、密码,很麻烦。想起来之前看过廖雪峰老师的教程Git——远程仓库一节里有提到SSH协议,现在刚好能起作用,整理要点如下。
1)SSH:
使用SSH协议,可以连接和验证远程服务器和服务。使用SSH密钥,您可以连接到GitHub,而无需在每次访问时提供您的用户名或密码。
2)首先确认自己的系统中是否已经拥有密钥。在默认情况下SSH的密钥存储在其~/.ssh目录下。可以使用以下命令进入目录并列出内容:

$ cd ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts

其中id_rsa和id_rsa.pub就是存储密钥的文件,带有.pub后缀的是公钥,另外一个则是私钥。
如果存在这些文件,则可以直接用$ cat id_rsa.pub来读取密钥内容。(要点)
如果不存在这些文件,则需使用如下命令创建(邮箱为注册Git时的邮箱)
ssh-keygen -t rsa -C “youremail@example.com”

参考材料:
1.http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001374385852170d9c7adf13c30429b9660d0eb689dd43a000
2.https://help.github.com/articles/connecting-to-github-with-ssh/
3.http://blog.csdn.net/u011836061/article/details/46559841
4.http://www.jianshu.com/p/697fe0815689

Hexo常用命令

发表于 2017-04-22

一、关联Hexo与Github

(1)安装扩展

需要安装hexo-deployer-git扩展:

npm install hexo-deployer-git –save
  
(2)修改_config.yml文件

添加类似如下的部署配置:

deploy:
type: git
repo: git@github.com:bingyue/bingyue.github.io.git
branch: master
  
执行
hexo clean #清除 Hexo 的缓存
hexo generate # 生成静态页面,可以简化为hexo g
hexo deploy # 部署到Github,可以简化为hexo d

二、Hexo博客编写
1)简单命令
hexo n 新建博客
hexo g 生成博客(静态页面)
hexo d 部署博客 (可与hexo g合并为 hexo d -g)
hexo s 开启服务 (hexo server的简写,本地启动)
PS:配置文件的冒号后必须有一个空格
重要:更多指南可见
http://lovenight.github.io/2015/11/10/Hexo-3-1-1-%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA%E6%8C%87%E5%8D%97/

2)编写文章
title: HelloWorld! # 文章页面上的显示名称,可以任意修改,不会出现在URL中
date: 2015-11-09 15:56:26 # 文章生成时间,一般不改
categories: # 文章分类目录,参数可省略

- 随笔
- 瞬间

tags: # 文章标签,参数可省略

- hexo
- blog # 个数不限,单个可直接跟在tags后面

这里开始使用markdown格式输入正文。

3)categories语法(tag也可使用类似语法)
第一种:
categories:

  • 一级分类
  • 二级分类
  • etc…

第二种:
categories: [一级分类, 二级分类]

三、更换主题
1)将想要的主题(如X)先克隆到自己电脑上:
cd your-hexo-site
Git clone https://github.com/iissnan/hexo-theme-next themes/next(X的git地址)。
2)安装主题
将站点配置文件_config.yml中的主题配置更换成theme:X即可
3)更多主题可见:https://www.zhihu.com/question/24422335
4)NexT官网:http://theme-next.iissnan.com/ 上有详细的操作方法

Flask 学习记录

发表于 2017-04-22

开展Flask学习中不明白的地方的记录。
5.6 定义模型
模型这个术语表示程序使用的持久化实体。在ORM中,模型一般是一个Python类,类中的属性对应数据库中的列。
ORM:抽象层,也称对象关系映射(ORM)或对象文档映射(ODM),在用户不知觉的情况下把高层的面向对象操作转换成低层的数据库指令。

5.11
源码控制工具可以根据源码文件的变化,类似地,数据库迁移框架能跟踪数据库模式的变化,然后增量式的把变化应用到数据库中。

第6章 电子邮件
Flask-Mail连接到简单邮件传输协议(SMTP)服务器,并把邮件交给这个服务器发送。如果不进行配置,Flask-Mail会连接localhost上的端口25,无需验证即可发送电子邮件。

Hello World

发表于 2017-04-20

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

TianAlchemy

TianAlchemy

不如笑归红尘去

5 日志
CSDN GitHub
友情链接
  • 我的信息
© 2017 TianAlchemy
由 Hexo 强力驱动
主题 - NexT.Mist