-
Notifications
You must be signed in to change notification settings - Fork 28
Home
Kohei Tamura edited this page Apr 4, 2018
·
1 revision
See also: http://blog.51cto.com/11736068/1978492
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database easybuggy;
Query OK, 1 row affected (0.00 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> insert into user (host,user,password) values("192.168.1.0/255.255.255.0",'root',password('password'));
mysql> grant all privileges on easybuggy.* to 'root'@'192.168.1.0/255.255.255.0' identified by 'password';
(venv) $ pip install --allow-all-external mysql-connector-python
(venv) $ vi config/settings.py
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'easybuggy',
'USER': 'root',
'PASSWORD': 'password',
'HOST': '192.168.1.102',
'PORT': '3306',
}
}
(venv) $ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, easybuggy, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying easybuggy.0001_initial... OK
Applying easybuggy.0002_auto_20180402_2210... OK
Applying easybuggy.0003_auto_20180402_2214... OK
Applying easybuggy.0004_auto_20180402_2219... OK
Applying sessions.0001_initial... OK
mysql> use easybuggy;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_easybuggy |
+----------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
| easybuggy_user |
+----------------------------+
11 rows in set (0.00 sec)
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('admin','admin','password','1000000000','false');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('admin02','admin02','pas2w0rd','2000000000','false');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('admin03','admin03','pa33word','3000000000','false');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('admin04','admin04','pathwood','4000000000','false');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user00','Mark','password','0000000000','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user01','David','pa32w0rd','1111111111','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user02','Peter','pa23word','2222222222','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user03','James','patwired','3333333333','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user04','Benjamin','password','4444444444','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user05','Eric','pas2w0rd','5555555555','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user06','Sharon','pa3world','6666666666', 'true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user07','Pamela','pathwood','7777777777','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user08','Jacqueline','password','8888888888','true');
mysql> insert into easybuggy_user (id, name, password, secret, ispublic) values ('user09','Michelle','pas2w0rd','9999999999','true');
mysql> update easybuggy_user set mail = concat(name, '@gmail.com');