markdown VIMでSQLを実行する环境

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown VIMでSQLを実行する环境相关的知识,希望对你有一定的参考价值。

## postgresqlの確認

```
(*^ - ^)❯postgres --version
postgres (PostgreSQL) 10.0
```

ない場合は、`brew install postgresql'


---

### postgresqlの設定

**DBの設定**
`initdb /usr/local/var/postgres -E utf8`

**パーミッションのエラーが出た場合**

```
The files belonging to this database system will be owned by user "ユーザー名".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
```

`sudo chown -R `whoami` /usr/local`

権限を変えておく。

[参考リンク](https://stackoverflow.com/questions/34797997/initdb-usr-local-var-postgres-on-el-capitan)


**サーバーの起動**

`brew services start postgresql`

**データベースの確認**

`psql -l`

ユーザーを作成しておくと良いかも

---

### dbextの設定

```
  Plug 'vim-scripts/dbext.vim', { 'for': 'sql' }

  let g:dbext_default_profile_psql = 'type=PGSQL:host=localhost:port=5432:dbname=squat:user=kage'
  let g:dbext_default_profile = 'psql'
  let dbext_default_buffer_lines=30
```

$HOMEに.pgpassを作成しておく

`hostname:port:database:username:password`

一行で良い。

.pgpassに関して、warningが出るようであれば`chmod 600 .pgpass`しておけば警告は消える。

コマンドに関しては、リンクを参照

[Qiita記事](https://qiita.com/0829/items/ce92a752bf832a06bcf2)

以上是关于markdown VIMでSQLを実行する环境的主要内容,如果未能解决你的问题,请参考以下文章

markdown rbenv环境の耙を実行する

ruby Rspec的で一行だけテストを実行する

csharp 团结から斯威夫特を実行するサンプル

javascript 171106 slickオプションで〇〇枚目にスライドした时にjsを実行する

apache_conf .htaccess用于在html文件/ html中运行phpファイル内からphpを実行する为の.htaccess

html RubyのコードをOpalでJavaScriptに変换·実行する