一、搭建运行环境 (centos8略去不写)1.mysql 5.77 版本安装步骤wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz 解压 ,移动到 /usr/local/mysqltar -zxvf mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz3.赋予mysql文件夹所属的用户组和用户,以及权限chmod -R 755 /usr/local/mysql chown -R mysql:mysql /usr/local/mysql遇到没用户组的,先添加用户和组groupadd mysql #添加mysql组 useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统 4.初始化mysqlcd /usr/local/mysql/bin ./mysqld --initialize --user=mysql --datadir=/u
Centos8忘记mysql5.7.44root密码的解决办法许久不用mysql把root密码给忘记了,整理下已做备用。编辑 /etc/my.cnf ,在末尾出增加 skip-grant-tables重启mysql服务systemctl restart mysqld登录mysql,并重置root密码为空mysql -u root登录以后use mysql; update user set authentication_string='' where User='root'; flush privileges; quit; 4.将 /etc/my.cnf 中 的 skip-grant-tables 去掉;5.再次重启mysql服务6.再次登录mysql,登录密码为空,然后修改root密码use mysql; ALTER user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '设置密码'; flush privileges;
查询有效库位#货位信息 #成品库区 原材料库区 #原材料巷道1 成品1号巷道 set @kuqu:="原材料库区"; set @xiangdao:= "原材料巷道4" ; select ba.alleyName as "巷道名称",bl.locationCode,bl.csFloor as"层数",bl.locationName from base_location bl,base_alley ba where bl.warehouseId ='cbab5bf356134711a94d4b95aac80f2f' #成品库区= 35d100c4545541a895f97825dfb95f4a 原材料= 9b2675fc97004da69d1e4f8bcf1a4e8a and bl.whareaId =(select bw.whareaId from base_wharea bw where bw.whareaName = @kuqu) #货位状态1:无货 2:有货 3:入库分配 4:出库分配 5:入
--查询堵塞 SELECT * FROM sys.sysprocesses WHERE blocked >0 ORDER BY blocked; --查询堵塞的详细语句 SELECT t1.resource_type, t1.resource_database_id, t1.resource_associated_entity_id, t1.request_mode, t1.request_session_id, t2.blocking_session_id FROM sys.dm_tran_locks as t1 INNER JOIN sys.dm_os_waiting_tasks as t2 ON t1.lock_owner_address = t2.resource_address; --查询死锁 select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJE
/ 查询最大的表TOP10 / -beginif object_id('tempdb..#Tab') is not nulldrop table #TabCREATE TABLE #Tab (NAME nvarchar(100) ,ROWS VARCHAR(100) ,reserved nvarchar(100) ,Data nvarchar(100) ,index_size nvarchar(18) ,Unused nvarchar(18) )GOINSERT #Tab EXEC SP_MSFOREACHTABLE 'EXEC sp_spaceused "?"'SELECT top 10 a.NAME as '名称',a.rows ,a.Data as '容量',a.index_size as '索引大小'-- CONVERT(INT,REPLACE(DATA,'KB','')) 按容量排序FROM #Tab a ORDER BY CONVERT(INT,REPLACE(DATA,'KB','')) DESC/ 查询最大的表TOP10 / -end/ 查询死锁 / -begi
登录SSMSEXEC sp_configure 'show advanced options', 1 GO RECONFIGUREGO EXEC sp_configure 'xp_cmdshell', 1 RECONFIGURE GOExEc xp_cmdshell 'mkdir C:\DataDB\'
RonTon
挨踢大叔