mysql 建立新的資料庫並且設定新的使用者名稱和密碼

2021-10-08 04:21:33 字數 674 閱讀 9491

create database iot default character set utf8 default collate utf8_general_ci;

grant all privileges on iot.* to 'iot'@'%' identified by 'iot';

grant all privileges on iot.* to 'iot'@'192.168.10.108' identified by 'iot';

grant all privileges on iot.* to 'iot'@'localhost' identified by 'iot';

flush privileges;

匯入資料庫

1、首先建空資料庫

mysql>create database abc;

2、匯入資料庫

方法一:

(1)選擇資料庫

mysql>use abc;

(2)設定資料庫編碼

mysql>set names utf8;

(3)匯入資料(注意sql檔案的路徑)

mysql>source /home/abc.sql;

方法二:

mysql -u使用者名稱 -p密碼 資料庫名 < 資料庫名.sql

#mysql -uabc_f -p abc < abc.sql

Mysql 簡介和建立新的資料庫

整數型 tinyint,smallint,int,bigint 小數型 float,double,decimal m,d 字元型 char,varchar 日期型 datetime date,timestamp 備註型 tinytext text longtext 建立乙個資料庫命令 create ...

建立mysql資料庫總結 MySQL資料庫總結

引擎 檢視mysql預設引擎 show variables like storage engine 檢視表引擎 show table status from 資料庫名 修改表引擎 alter table 表名 engine innodb 建立時直接定義引擎 create table 表名 engin...

建立mysql資料庫

登陸資料庫 如何建立乙個資料庫和表單 new mysql.php 獲取連線mysql connect 伺服器,使用者名稱,密碼 con mysql connect localhost root if con 建立乙個資料庫school if mysql query create database s...