Mac installation MySQL and terminal operation MySQL and pycharm database visualization

Source: Internet
Author: User

One. Mac install MySQL

Download MySQL First, address: https://dev.mysql.com/downloads/mysql/

Then you know the installation is good, there will be a hint to remember the password, and then installed ....

To change the password, refer to: http://blog.csdn.net/soft2buy/article/details/50223373

Two. Terminal Operation MySQL

First find MySQL in System preferences, such as left one, then open, run MySQL, make it appear running, such as the right one.

Then open the terminal and enter the MySQL path/usr/local/mysql/bin/mysql-u root-p

Then enter the password (the password is your MySQL password, no change is when you install the initial password or no password)

Create a database with the following table:

1 #CREATE DATABASE: Scrapydb, in UTF8 bit encoded format, each statement ending with '; '2CREATE DATABASE scrapydb CHARACTER SET'UTF8';3 4 #Select the table you just created:5 Use scrapydb;6 7 #Create the fields we need: Fields to match one by one of our code, so we can write SQL statements in a minute .8 CREATE TABLE Weather (9 ID INT auto_increment,TenDate char (24), OneWeek CHAR (24), AIMG Char (128), -Temperature char (24), -Weather Char (24), theWind char (24), - PRIMARY KEY (ID) -) Engine=innodb DEFAULT charset='UTF8';
1 #CREATE DATABASE: Scrapydb, in UTF8 bit encoded format, each statement ending with '; '2CREATE DATABASE scrapydb CHARACTER SET'UTF8';3 4 #Select the table you just created:5 Use scrapydb;6 7 #Create the fields we need: Fields to match one by one of our code, so we can write SQL statements in a minute .8 CREATE TABLE Weather (9 ID INT auto_increment,TenDate char (24), OneWeek CHAR (24), AIMG Char (128), -Temperature char (24), -Weather Char (24), theWind char (24), - PRIMARY KEY (ID) -) Engine=innodb DEFAULT charset='UTF8';

See what the weather table looks like

 from Weather   or: desc weather

For other MySQL operations please refer to the official documentation or http://www.runoob.com/mysql/mysql-tutorial.html

Three. Visualization of the database through the Pycharm databases setting

First open the Pycharm, through the views----Windows--Database open, click the Add button, will let us choose the data Source, basically databases have (here we choose MySQL), Fill in the User and password, click Test Connection (if test Connection can not be used, should be driver not downloaded, the page has a download button, a single direct download can be).

If our username and password are correct, successful will be displayed at this point.

Click on the OK button at this time, on the right side of pycharm can be viewed.

Direct stand-alone table name to view the contents of the database

The above is through the Pycharm database to realize the visualization of databases.

Mac installation MySQL and terminal operation MySQL and pycharm database visualization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.