mysql-management

Table Variable As a parameter In My sql Stored Procedures

随声附和 提交于 2020-06-13 08:06:26
问题 Can i pass table variable as a PARAMETER To a Stored Procedure in MySql 回答1: If you want to pass a table into the stored procedure as parameter - then answer is no. Only scalar values can be passed. The table can be accessed by its name directly; if you want to use that table name to construct and run new query in procedure, then have a look at prepared statements. 回答2: yes TableA: MyId MyNumber 1 5 2 6 3 9 Select myNumber, MyStoredProcedure(MyNumber) from TableA where MyNumber > 5 来源: https:

Table Variable As a parameter In My sql Stored Procedures

爱⌒轻易说出口 提交于 2020-06-13 08:05:47
问题 Can i pass table variable as a PARAMETER To a Stored Procedure in MySql 回答1: If you want to pass a table into the stored procedure as parameter - then answer is no. Only scalar values can be passed. The table can be accessed by its name directly; if you want to use that table name to construct and run new query in procedure, then have a look at prepared statements. 回答2: yes TableA: MyId MyNumber 1 5 2 6 3 9 Select myNumber, MyStoredProcedure(MyNumber) from TableA where MyNumber > 5 来源: https:

Reducing memory consumption of mysql on ubuntu@aws micro instance

跟風遠走 提交于 2020-01-30 13:51:07
问题 I have recently started on a PoC project wherein we are developing a small web app. The initial setup is done on a micro instance from AWS. We are on rails+mysql stack. After installing/running MySQL, I see that about 500+ MB RAM has been consumed already; leaving quite less for rest of the systems (micro instances have barely 620 MB RAM). Our app is fairly simple at this stage. Can I do something to reduce the memory consumed by MySQL server? Appreciate the help. 回答1: Change this setting in

MySQL - Should I use multi-column primary keys on every child table?

随声附和 提交于 2019-12-23 04:28:27
问题 Setup: I was trying to understand the difference between identifying and non-identifying relationships when I found this great article on stackexchange. What's the difference between identifying and non-identifying relationships? After reading a few comments it brought another question to mind about a problem I have been having. Question: Should I use multi-column primary keys on every child table and what are the advantages/disadvantages to doing so? To better illustrate my question I have

MySQL connection using ODBC (5.1) with SSL

梦想的初衷 提交于 2019-12-21 17:42:31
问题 We've got a client application that connects to our online MySQL database (5.1.44-community-log) thru a ODBC connector (the server is a managed* dedicated webserver). This works very nice. However I can't get it to work using SSL. This is what I've done so far: 1. MySQL server I've got the server manager* set up MySQL with SSL, this is 'proven by': mysql> SHOW VARIABLES LIKE '%ssl%'; which results is this response: +---------------+---------------------------------+ | Variable_name | Value |

MySQL find unused tables

℡╲_俬逩灬. 提交于 2019-12-21 17:00:10
问题 I am working with a database which unfortunately has a lot of unused tables and I am trying to clean it up. I'm trying to find a way where I can be 100% confident that a particular table is no longer being used. After some googling, I still cannot find a good way to do so. I am only able to tell the last writes to a table (INSERT, UPDATE, etc) using: SHOW TABLE STATUS or running ls -lt on the mysql datadir (can be found by by running SHOW VARIABLES LIKE 'datadir';) Do you have any other

Truncate all tables (most of which have constraints). How to temporarily drop them

纵然是瞬间 提交于 2019-12-20 09:57:48
问题 I have a development database (MYSQL) which I would like to load with fresh data at some point. I would like to delete the content of all tables. What is the best way, as automated as possible, to delete the content of all tables (including those that have foreign key constraints). Is there a truncate all/ drop all equivalent constraints? Thanks 回答1: I think you can do the following: Disable the foreign key constraint check mysql> SET FOREIGN_KEY_CHECKS = 0; Truncate your tables mysql>

Is there a faster way to load mysqldumps? [duplicate]

风流意气都作罢 提交于 2019-12-20 09:37:02
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Speeding up mysql dumps and imports mysqldump is reasonably fast, but dumps of a medium-sized database (20-30 megs) take several minutes to load using mysql my_database < my_dump_file.sql Are there some mysql settings I can tune to speed up the load? Is there a better way to load saved data? I've experimented using the mysqlimport utility with CSV-based dumps. These load slightly--but not appreciably--faster. I

How to monitor MySQL space?

北战南征 提交于 2019-12-20 09:07:13
问题 I downloaded a VM image of a web application that uses MySQL. How can I monitor its space consumption and know when additional space must be added? 回答1: I have some great big queries to share: Run this to get the Total MySQL Data and Index Usage By Storage Engine SELECT IFNULL(B.engine,'Total') "Storage Engine", CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", CONCAT(LPAD(REPLACE( FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,'

mysql command for showing current configuration variables

半城伤御伤魂 提交于 2019-12-20 08:12:38
问题 Can not find a command that displays the current configuration of mysql from within the database. I know I could look at /etc/mysql/my.cnf but that is not what I need. 回答1: What you are looking for is this: SHOW VARIABLES; You can modify it further like any query: SHOW VARIABLES LIKE '%max%'; 回答2: Use SHOW VARIABLES : show variables like 'version'; 回答3: As an alternative you can also query the information_schema database and retrieve the data from the global_variables (and global_status of