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