This is the first note. It’s about how to use mysql in docker, how to use hexo to build blog and post it on Github using Pages.
First how-to-do note(mysql with docker、hexo)
Due to my project in college, I have to migrate the MYSQL 5.5
environment to MYSQL 8.0
version on my cloud hosting, but with a problem that I ccouldn’t start my mysql.service
correctly ,I decided to deploy mysql
with docker
and learning basic docker
using skills in the meantime.
By the way I have forgotten how to build my GitHub Pages with hexo
, and this time I will give it a summary.
Basic Steps for MySQL Server Deployment with Docker
Basic Usage
first you need to install docker
and test it (using root on debian)
1 | $ apt update |
some usages
1 | # show help |
About MYSQL
then we have a mysql docker, can be accessed by localhost:33060, but some configurations are needed
1 | # this step is to see original password |
Now we have a mysql docker which can be accessed remotely
GitHub Pages with Hexo
Using Hexo
Node.js is required, and Git is required on Windows
1 | $ npm install hexo -g # use npm |
directory structure
1 | . |
common usages
1 | $ hexo new passagename # create passagename.md in source/_posts/ |
simplify:
hexo n == hexo new
hexo g == hexo generate
hexo s == hexo server
hexo d == hexo deploy
combine:
$ hexo deploy -g
$ hexo server -g
$ hexo d -g
$ hexo s -g
GitHub Part
first you need a
github
accountthen create a repository named :
xxx.github.io
(xxx =>github
username)configure your ssh public-key to login
github
without password (necessary for windows git)
- configure git’s username & email (ensure your updates show on the wall)
1
2$ git config --global user.name "your GitHub username"
$ git config --global user.email "your GitHub mailaddress" - check out whether you have public/private keys
1
2
3
4
5$ cd ~/.ssh
$ ls
# things may look like ...
authorized_keys2 id_rsa known_hosts
config id_rsa.pub - if you can see
xxx
andxxx.pub
, it means u got a keypair - if not, generate by yourself
1
2
3$ ssh-keygen -t rsa -C "xx@xx.com"
# '-t' have encryption method followed, and 'rsa' can be replaced
# no need to bother other args - type some password once, and you have a keypair now
- then paste strings in
xxx.pub
to :github
index -> ur head portrait -> Settings -> SSH and GPG keys
and now you can logingithub
without typing password in ssh or git bash
- configure hexo
- in _config.yml (xxx=>
github
username):1
2
3
4
5
6
7
8
9
10
11
12# if only deploy to one repo
deploy:
type: git
repo: git@github.com:xxx/xxx.github.io.git
branch: master
# deploy to two or more repos
deploy:
type: git
repo:
github: git@github.com:xxx/xxx.github.io.git
gitlab: git@gitlab.com:xxx/xxx.gitlab.io.git
branch: master - install plugin
1
2
3$ npm install hexo-deployer-git --save
# $ npm install hexo-generator-search --save
$ npm install hexo-generator-searchdb --save # needed for my theme. - deploy blog on github
1
2
3$ hexo deploy
# or
$ hexo -d - sticky post
1
2
3$ npm uninstall hexo-generator-index --save
$ npm install hexo-generator-index-pin-top --save
# add 'top: true' in 'Front-matter' to use itNotes for Markdown in Hexo
Replace< >
with< >
//maybe not necessary
When using {something...}
, add {% raw %} at the front and {% endraw %} as the tail,and finally it looks like {% raw %}{something...}{% endraw %}
in your text to escape {
and}
but in the code block sorrounded by three `, you can input whatever u want.
As for multiple tags in hexo articles writing, use tags:[tag1, tag2, …]
image hosting
https://sm.ms/
tables generator
http://www.tablesgenerator.com/