[py]py3/pip/mysql环境安装

Posted 毛台

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[py]py3/pip/mysql环境安装相关的知识,希望对你有一定的参考价值。

win下正确姿势安装py3

  • 选择64bit的python3
  • 选择自定义安装

技术分享图片

  • 选择安装位置

技术分享图片

  • 安装pip
yum install install python-pip -y
cd
mkdir ~/.pip
cat > .pip/pip.conf<<EOF
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
 
[install]
trusted-host=mirrors.aliyun.com
EOF
  • 安装虚拟环境
pip install virtualenv
pip install virtualenvwrapper
pip install virtualenvwrapper-win
mkvirtualenv --python=C:\Python27\python.exe py27env
exit
mkvirtualenv --python=C:\Python36\python.exe py36env
workon  #查看刚刚创建的环境,mkvirtualenv  -h查看帮助
  • py3安装mysql-devel驱动程序
pip install pymysql

pycharm设置

  • 导入配置
wget https://github.com/lannyMa/scripts/blob/master/pycharm/settings.jar
file -> import settings就ok了



黄色不伤害眼睛的rgb
255 251 232
FFFBE8

技术分享图片

  • 设置terminal
File -> Settings -> Tools -> Terminal

for 64bit:
"C:\Program Files\Git\bin\sh.exe" -login -i

for 32bit:
"C:\Program Files (x86)\Git\bin\sh.exe" -login -i
"C:\Windows\System32\cmd.exe" /C "bash"

mysql for win

下载安装

MySQL Community Server 5.7.16
http://dev.mysql.com/downloads/mysql/

cd D:\Program Files\mysql-5.7.19-winx64\bin
mysqld --initialize-insecure

添加path

D:\Program Files\mysql-5.7.19-winx64\bin

启动MySQL服务

"D:\Program Files\mysql-5.7.19-winx64\bin\mysqld" --install

net start mysql

mysql -u root -p


"D:\Program Files\mysql-5.7.19-winx64\bin\mysqld" --remove
net stop mysql


create database bbs;
grant all on bbs.* to [email protected] identified by '123456';
grant all on bbs.* to [email protected]'%' identified by '123456';

字符集

SET NAMES 'utf8'; 
SET character_set_client = utf8;
SET character_set_connection = utf8;
SET character_set_database = utf8;
SET character_set_results = utf8;
SET character_set_server = utf8;

SET collation_connection = utf8_general_ci;
SET collation_database = utf8_general_ci;
SET collation_server = utf8_general_ci;

缺陷是: 登出后设置的就失效了.
show variables like '%storage_engine%';

show VARIABLES like '%max_allowed_packet%';
show variables like '%storage_engine%';
show variables like 'collation_%';
show variables like 'character_set_%';

mysql另一种配置文件持久化:

D:\Program Files\mysql-5.7.19-winx64\my.ini
[mysqld]
default-storage-engine = innodb
innodb_file_per_table = 1
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'

[mysql]
default-character-set = utf8

[mysql.server]
default-character-set = utf8


[mysqld_safe]
default-character-set = utf8


[client]
default-character-set = utf8


参考: http://blog.csdn.net/u013474104/article/details/52486880

mysql配置及命令参考

- mysql生产配置参考
https://www.teakki.com/p/57e227aea16367940da625f8


- 配置文件查找先后顺序
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
C:\windows\my.ini
C:\my.ini
E:\dev\mysql57\my.ini

- 通过配置文件设置字符集
default-storage-engine = innodb
innodb_file_per_table = 1
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'


- 查看建表语句
show create database test;


- 查看权限
show grants

以上是关于[py]py3/pip/mysql环境安装的主要内容,如果未能解决你的问题,请参考以下文章

虚拟环境安装pyqt5以及转换为.py文件

anaconda环境中---py2.7下安装tf1.0 + py3.5下安装tf1.5

请教如何在没有安装python的环境中执行py脚本

pyhton 虚拟环境生成requirements.txt 和利用requirements.txt批量安装

json 单击VSCode的setup.py片段(可能还有其他编辑器)

python中的模块,库,包有啥区别