做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

怎樣實(shí)現(xiàn)node連接mysql的方法

來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 20:01:00
文檔

怎樣實(shí)現(xiàn)node連接mysql的方法

怎樣實(shí)現(xiàn)node連接mysql的方法:這次給大家?guī)?lái)怎樣實(shí)現(xiàn)node連接mysql的方法,實(shí)現(xiàn)node連接mysql的注意事項(xiàng)有哪些,下面就是實(shí)戰(zhàn)案例,一起來(lái)看一下。mysql基本命令修改root密碼123為1234mysqladmin -u root -p 123 password 1234;顯示數(shù)據(jù)庫(kù)show databases;創(chuàng)建數(shù)
推薦度:
導(dǎo)讀怎樣實(shí)現(xiàn)node連接mysql的方法:這次給大家?guī)?lái)怎樣實(shí)現(xiàn)node連接mysql的方法,實(shí)現(xiàn)node連接mysql的注意事項(xiàng)有哪些,下面就是實(shí)戰(zhàn)案例,一起來(lái)看一下。mysql基本命令修改root密碼123為1234mysqladmin -u root -p 123 password 1234;顯示數(shù)據(jù)庫(kù)show databases;創(chuàng)建數(shù)

這次給大家?guī)?lái)怎樣實(shí)現(xiàn)node連接mysql的方法,實(shí)現(xiàn)node連接mysql的注意事項(xiàng)有哪些,下面就是實(shí)戰(zhàn)案例,一起來(lái)看一下。

mysql基本命令

修改root密碼123為1234

mysqladmin -u root -p 123 password 1234;

顯示數(shù)據(jù)庫(kù)

show databases;

創(chuàng)建數(shù)據(jù)庫(kù),例如:

create database database_test
create database [database];

使用數(shù)據(jù)庫(kù),例如:

use database_test
use [database];

刪除數(shù)據(jù)庫(kù),例如:

drop database database_test
drop database [database];

創(chuàng)建表,例如:

create table_test(name char(10) not null,age int(4))
create table <table>(<field><type>);

插入數(shù)據(jù),例如:

insert into table_test (name,age) values ('vist',24)
insert into <table>(<field>) values (<value>);

查詢數(shù)據(jù),例如:

select * from table_test
select * from <table>;

修改數(shù)據(jù),例如:

update table_test set age=18 where name='vist'
update <table> set <fidld>=<value> where <if>;

刪除數(shù)據(jù),例如:

delete from table_test where name='vist'
delete from <table> where <if>;
node配置

需要安裝mysql包

npm install mysql

node連接數(shù)據(jù)庫(kù)

var mysql=require('mysql');var database='database_test';var table='table_test';

配置用戶密碼

var client=mysql.createConnection({ user: 'root', passowrd: '1234'
 });

連接數(shù)據(jù)庫(kù)

client.connect();console.log('連接數(shù)據(jù)庫(kù)');

使用數(shù)據(jù)庫(kù)

client.query('use '+ database);

查詢操作

client.query('select * from '+ table , function(err, results, fields){ if(err){ throw err;
 } if(results){ console.log('查詢');
 results.map(function(item){ console.log('%s\t%d', item.name, item.age);
 })
 }
 });

插入操作

client.query('insert into '+ table + '(name, age) values (?, ?)', ['bestvist',20], function(err, results, fields){ if(err){ throw err;
 } if(results){ console.log('插入'); console.log(results);
 }
 });

更新操作

client.query('update '+ table + ' set age=? where name=?',[18, 'bestvist'],function(err, results, fields){ if(err){ throw err;
 } if(results){ console.log('更新'); console.log(results);
 }
 });

刪除操作

client.query('delete from '+ table +' where name=?', ['bestvist'], function(err, results, fields){ if(err){ throw err;
 } if(results){ console.log('刪除'); console.log(results);
 }
 })

關(guān)閉數(shù)據(jù)庫(kù)

client.end();

相信看了本文案例你已經(jīng)掌握了方法,更多精彩請(qǐng)關(guān)注Gxl網(wǎng)其它相關(guān)文章!

推薦閱讀:

用JS實(shí)現(xiàn)排序算法

JS的正則表達(dá)式如何使用

聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

怎樣實(shí)現(xiàn)node連接mysql的方法

怎樣實(shí)現(xiàn)node連接mysql的方法:這次給大家?guī)?lái)怎樣實(shí)現(xiàn)node連接mysql的方法,實(shí)現(xiàn)node連接mysql的注意事項(xiàng)有哪些,下面就是實(shí)戰(zhàn)案例,一起來(lái)看一下。mysql基本命令修改root密碼123為1234mysqladmin -u root -p 123 password 1234;顯示數(shù)據(jù)庫(kù)show databases;創(chuàng)建數(shù)
推薦度:
標(biāo)簽: 方法 訪問(wèn) 的方法
  • 熱門(mén)焦點(diǎn)

最新推薦

猜你喜歡

熱門(mén)推薦

專題
Top
主站蜘蛛池模板: 芜湖市| 阳朔县| 拜泉县| 鄢陵县| 隆昌县| 枣强县| 黄龙县| 东安县| 扎囊县| 龙胜| 巫溪县| 呼图壁县| 蛟河市| 富顺县| 宾川县| 合作市| 尚义县| 怀仁县| 富川| 廉江市| 平原县| 麻城市| 新干县| 凤台县| 昌图县| 秦皇岛市| 三都| 安宁市| 华池县| 钟山县| 郯城县| 五河县| 米脂县| 定安县| 漳浦县| 永济市| 湄潭县| 丹棱县| 缙云县| 西盟| 香格里拉县|