当前位置:网站首页>Setting optimization and use of MySQL and SQL Server
Setting optimization and use of MySQL and SQL Server
2022-07-23 11:26:00 【I'm Wang Xi】
List of articles
mysql
Some settings of the database
Open remote login
grant all privileges on *.* to 'root'@'%' identified by 'wangshiyi';by And then there's the code flush privileges; // Refresh the permissionsThis command cannot be used in high-level databases. It should be executed step by stepcreate user 'root'@'%' identified by 'wangshiyi' grant all privileges on *.* to 'root'@'%' with grant option; flush privileges; Refresh the permissionsMySQL GROUP BY Error setting
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
restart mysql service
If there is still a problem with the stored procedure , Just modify it and save the stored procedure again ( For example, add a space after )
Remember that the configuration file needs to be changed in the future , Then transfer the database data
About database optimization
- Add... Before the statement EXPLAIN
After execution, it will tell you where the index is missing , The speed of execution
Some queries
- The character set of the field does not match
$query->whereRaw("BINARY ".$v['field']." ".$v['condition']." BINARY '".$v['parameter'] . "'");
sql server
Some queries and usage
- sql server Time sequence , Empty time in front
$query->orderByRaw("sort desc,case when status_date is null then 1 else 0 end desc,status_date desc")
- laravel seqserver Stored procedure query error
Report errors :The active result for the query contains no fields.
Addset nocount on
for example
ALTER PROCEDURE TESTPROC
@N INT
AS
BEGIN
SET NOCOUNT ON;
IF @N=1
RETURN 0;
SET NOCOUNT OFF;
PRINT '2';
END
php Query multiple result sets
- Without reference
$dbh = DB::connection()->getPdo();
$stmt = $dbh->prepare("exec SP_ORDERSEC_GETORDERID");
$stmt->execute();
$stmt->nextRowset();// Next result set
$rowset_2 = $stmt->fetch();
// It cannot be used without closing DB
$stmt = null;// close pdo Transaction connection
$order_id = trim($rowset_2['ORDER_ID']);// The second result set
- With parameters
$dbh = DB::connection()->getPdo();
$stmt = $dbh->prepare("exec sp_demo_get ?,?,?,?");
$nReturnValue = " Parameters 1";
$strReturnValue = " Parameters 2";
$strSearchValue = " Parameters 3";
$strSearchValues = " Parameters 4";
$stmt->bindParam(1, $nReturnValue, \PDO::PARAM_STR);
$stmt->bindParam(2, $strReturnValue, \PDO::PARAM_STR);
$stmt->bindParam(3, $strSearchValue , \PDO::PARAM_STR);
$stmt->bindParam(4, $strSearchValues , \PDO::PARAM_STR);
$stmt->execute();
$stmt->nextRowset();
$rowset_2 = $stmt->fetch();
$stmt = null;// close pdo Transaction connection
$order_id = trim($rowset_2['k_wage']);// Work order ID, The second result set
边栏推荐
- 解决手动查询Oracle数据库时间格式不正确的问题(DATE类型)
- Precautions for realizing "real-time data response" on the page
- Sequencing, current limiting
- C语言中的流氓goto语句
- The object in $attrs doesn't change, but it triggers watch listening?
- Sorting out common SQL interview questions and answers
- Pytorch white from zero uses North pointing
- 【C语言】什么是函数?函数的分类和侧重(帮你快速分类和记忆函数)
- JS class array objects and methods of class array conversion (ES6, Es5)
- JS higher order function
猜你喜欢

Pyspark learning notes

The super simple face recognition API can realize face recognition in just a few lines of code

Precautions for realizing "real-time data response" on the page
![[C language] what is a function? Classification and emphasis of functions (help you quickly classify and remember functions)](/img/3b/39be991aa30b31ff5fb49905de36cf.jpg)
[C language] what is a function? Classification and emphasis of functions (help you quickly classify and remember functions)

NepCTF 2022 MISC <签到题>(极限套娃)

MySQL增删改查&&高级查询语句

Scattered notes of machine learning: some concepts and notes

Fun code rain, share it online~-

my_ Implementation of strcpy (classic, simple, practical, collection)

自定义公式输入框
随机推荐
自定义公式输入框
Redis database and project framework
Understanding of closures of JS
高阶函数的应用:手写Promise源码(三)
[pytho-flask筆記5]藍圖簡單使用
Anti shake and throttling of JS
第一篇博客
高阶函数的应用:手写Promise源码(四)
D2DEngine食用教程(2)———绘制图像
高阶函数的应用:手写Promise源码(一)
some、every、find、findIndex的用法
中间人攻击arp欺骗及与beef-xss联动
Inheritance mode of JS
Application of higher-order functions: handwritten promise source code (4)
slice()和splice()区别
机器学习零散笔记:一些概念和注意
Mixed view base class
$attrs中的对象没有变化,但触发了watch监听?
uni-app小程序中v-show与display:flex一起使用时v-show不生效!
MySQL之函数&视图&导入导出