項目名稱:天天生鮮
開發(fā)環(huán)境安裝
系統(tǒng):ubuntu
數(shù)據(jù)庫:MySQL
- 安裝
sudo apt-get install mysql-server mysql-client
sudo pip install mysql-python
- 啟動
service mysql start
- 停止
service mysql stop
- 重啟
service mysql restart
- 允許遠程連接
找到mysql配置文件并修改
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
將bind-address=127.0.0.1注釋 - 登陸
mysql -u root -p
- 查看默認密碼
進入/etc/mysql/debian.cnf文件言沐,查看鹤啡。 - 修改密碼
set password for 'root'@'localhost' = password('yourpass')
SQL
創(chuàng)建數(shù)據(jù)庫
create database test;使用數(shù)據(jù)庫
use test;刪除數(shù)據(jù)庫
drop database test;創(chuàng)建表
create table users(login varchar(8),userid int,projid int);刪除表
drop table users;插入行
insert into users values('leanna',2111,1);