当前位置:网站首页>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
边栏推荐
- slice()和splice()区别
- some、every、find、findIndex的用法
- mysql和sql server的设置优化及使用
- flex+js实现内部盒子高度跟随其中最大的高度
- Pycharm occupies C disk
- When v-show is used with display:flex in the uni app applet, v-show does not take effect!
- JS call, apply, bind
- [metric]使用Prometheus监控flink1.13org.apache.flink.metrics
- Application of higher-order functions: handwritten promise source code (III)
- xtu-ctf Challenges-Reverse 1、2
猜你喜欢

Spark常见面试问题整理

基于el-table的树形表格及js-xlsx实现下载excel功能(二)

Precautions for realizing "real-time data response" on the page

自定义MVC的使用&增删改查
D2dengine edible tutorial (1) -- the simplest program

动态设置卡片的主题色
![[python flask notes 5] blueprint is easy to use](/img/0a/00b259f42e2fa83d4871263cc5f184.png)
[python flask notes 5] blueprint is easy to use

Simple implementation of rectangular area block

Redis database and project framework

Machine learning algorithm for large factory interview (6) time series analysis
随机推荐
js中类数组对象以及类数组转换的方法(ES6, ES5)
JS class array objects and methods of class array conversion (ES6, Es5)
用getchar清理缓冲区(强烈推荐,C语言易错典型)
js的闭包的理解
Understanding of closures of JS
Large factory interview machine learning algorithm (0): Feature Engineering | data preprocessing
Spark常见面试问题整理
Using pytorch to realize the flower recognition classifier based on VGg 19 pre training model, the accuracy reaches 97%
存储过程 两次排序加一次随机取数据
MySQL之账号管理&&四大引擎&&建库建表
JS, pay attention to passing parameters. If it is a string, you need to add escape characters
构造函数,原型链,instanceOf
简单实现矩形面积块
Application of higher-order functions: handwritten promise source code (II)
Redis database and project framework
MySQL索引&&执行计划
页面实现 “实时数据响应” 的注意事项
Clear the buffer with getchar (strongly recommended, C language is error prone, typical)
How to merge the website content with video and audio separated? How to write batch download code?
PyGame realizes the airplane war game