Superset Link Local MySQL Database

Source: Internet
Author: User
Tags virtual environment

Just installed superset When everyone knows it is used automatically generated Sqllite database, if we want to let the device link to their own database, to share my approach to MySQL, for example:

1. Install the database MySQL:

$ sudo apt-get install Mysql-server

$ sudo apt-get install mysql-client

$ sudo apt-get install Libmysqlclient-dev

You must remember to set the startup MySQL password during the installation process.

2. Start MySQL and create a database

$ mysql-u Root-p

After entering the password, the command:

Mysql> CREATE DATABASE Teamwork

Teamwork for the library name

Then manipulate the database, you can use a well-written SQL script file:

Drop database ' teamwork '; Create database ' teamwork '; use ' teamwork '; CREATE table ' teams ' (' team_id ' int (one) not null Auto_i  Ncrement, ' team_name ' varchar (not null), ' Team_intro ' varchar ($) NOT null, ' Team_builderid ' int (one) not NULL, primary Key (' team_id '), key ' Team_ibfk_1 ' (' Team_builderid '), constraint ' team_ibfk_1 ' foreign key (' Team_builderid ') References ' users ' (' user_id ') on the DELETE cascade on UPDATE cascade) engine = InnoDB default Charset=utf8;insert into teams VALUES (1, ' Team 1 ', ' Basketball group ', ' 1 '), (2, ' Team 2 ', ' hobbies ', ' 1 '), (3, ' Team 3 ', ' Group ', ' 1 '), (4, ' Team 4 ', ' Basketball group ', ' 2 ');

Save this file as Teamwork.sql, and the terminal executes the command:

$ mysql-u root-p Teamwork

The above command is to execute the SQL file in the database teamwork, note that/home/wang/py3env/teamwork.sql is the storage path, teamwork is an existing database.

After entering the password, you can type the command to see if it is successful:

Mysql> Show Database;

mysql> use teamwork;

Mysql> Show tables;

3. Configure the superset configuration file, config.py

Change the original database to MYQSL.

4. Reconfigure login account

This time the database is a new state, before the login account in SQLite has no need to reset:

$ (py3env) [email protected]:~/py3env$ fabmanager create-admin--app Superset

$ (py3env) [email protected]:~/py3env$ superset DB Upgrade

$ (py3env) [Email protected]:~/py3env$ superset Init

Note that these operations are done with the activation of the virtual environment.

This time restart superset is complete:

$ (py3env) [Email protected]:~/py3env$ superset Runserver

Specifically how this thing is used, back in the study to supplement ...

Superset Link Local MySQL Database

Related Article

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.