mysql-5.5

SELECT + INSERT + Query Cache = MySQL lock up

混江龙づ霸主 提交于 2020-11-29 04:02:30
问题 MySQL server seems to constantly lock up and stop responding on certain types of queries and eventually (after couple of minutes of not responding) give up with an error " MySQL server has gone away ", then hang again on the next set of queries, again and again. The server is set up as a slave to replicate from a master to dbA , mostly INSERT statements, around 5-10 rows per second. A PHP based application is running on the server that reads the freshly replicated data every 5-10 seconds,

MySQL 5.5 errno: 150 “Foreign key constraint is incorrectly formed”

吃可爱长大的小学妹 提交于 2020-06-08 14:43:41
问题 There are plenty of questions regarding this error but I can't seem to find any similar scenario to what I have. My 1st table (users): My 2nd table (colleges): I am trying to alter 1st table and add a foreign key that references id of a 2nd table : ALTER TABLE users ADD CONSTRAINT FOREIGN KEY (collegelinkId) REFERENCES databaseName.colleges (id); Which fails with error (errno: 150 "Foreign key constraint is incorrectly formed") . The only parameter that is different between these two tables

Join two tables with SUM and COUNT

淺唱寂寞╮ 提交于 2020-01-06 05:53:21
问题 I am attempting to join two tables and also get a SUM and COUNT. I need to get the SUM QTY from history table and COUNT SN for each PN and LOC from rota table. History table: create table history ( code int(10) primary key, PN varchar(10) not null, LOC varchar(10) not null, Qty int(10) not null); insert into history values (1, 'T1', 'AAA', 1); insert into history values (2, 'A1', 'BBB', 2); insert into history values (3, 'J1', 'CCC', 3); insert into history values (4, 'A2', 'AAA', 1); insert

MySQL round in query, wrong result

百般思念 提交于 2019-12-25 09:19:15
问题 I have a question about a query that I'm running on a MySQL Server (v5.5.50-0+deb8u1). SELECT 12 - (SELECT qty FROM Table WHERE id = 5213) AS Amount so Amount value is 12 - 8,5500000000000007 = 3.4499999999999993 But if I run the query: SELECT qty FROM Table WHERE id = 5213 it returns 8.55 that is the correct number written in the record, so I was expecting that the first querty returned 3.45. The "qty" column in the table "Table" is a DOUBLE. How is it possibile? How can I get the right

How should I properly store and retrieve IPs?

本秂侑毒 提交于 2019-12-25 01:55:09
问题 I have table Users with one column user of type VARCHAR(15) . I can insert a period into it: INSERT INTO `LJ`.`Users` (`user`) VALUES ('.') Now I want to search for this period: SELECT * FROM `Users` WHERE `user` LIKE '.' or SELECT * FROM `Users` WHERE `user` = '.' In both cases, the existing entry is not found: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0001 sec) The same problem with the comma. Actually, my intention is to store IP addresses like 125.50.75.80, but I

gettting an error while defining the event name on mysqlworkbench 5.5

允我心安 提交于 2019-12-20 05:45:35
问题 I created a stored procedure like the following: -- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments before and after the routine body will not be stored by the server -- -------------------------------------------------------------------------------- DELIMITER $$ CREATE DEFINER=`MailMe`@`%` PROCEDURE `sp_archivev3`() BEGIN INSERT INTO send.sgev3_archive(a_bi, b_vc, c_int, d_int, e_vc, f_vc, g_vc, h_vc, i_dt, j_vc, k_vc, l_vc, m

how to do LOAD DATA LOCAL INFILE in laravel 5.4

爷,独闯天下 提交于 2019-12-20 04:38:29
问题 i need to convert the following query in laravel 5.4 $loadDataToTempTableSql = "LOAD DATA LOCAL INFILE '".$filename."' INTO TABLE ABC FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\r' IGNORE 1 LINES"; $loadDataToTempTableRes = mysqli_query($link,$loadDataToTempTableSql); $loadedData = mysqli_affected_rows($link); what i did Step1: DB::select($load_data_to_temp_table_sql); which is throwing exception: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while

Can't start MySQL5.5 on Ubuntu 12.04 - “dpkg: dependency problems”

可紊 提交于 2019-12-18 11:04:30
问题 This appears to be a common problem on 12.04. I've tried everthing in this thread including: sudo apt-get clean sudo apt-get autoclean sudo apt-get remove --purge mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 sudo apt-get install mysql-server I still get the same old error. Installing/starting MySql5.5 looks like this: apt-get install -f mysql-server Reading package lists... Done Building dependency tree Reading state information...

Why can't I uninstall mysql-5.5 & install mysql-5.6 on Amazon Linux machine?

时光怂恿深爱的人放手 提交于 2019-12-14 00:11:48
问题 I'm on a 64-bit Amazon Linux machine. I had previously installed mysql-server 5.5. (using sudo yum install ) However, I soon found out that my application requires MySql-serve 5.6. So I uninstalled mysql-server 5.5. (using sudo yum remove mysql-server ) and now I'm following these instruction to install mysql-server 5.6. But I'm running into a problem. when I try to do the second install, I get the following 2 errors: file /usr/lib64/mysql/libmysqlclient.so.18 from install of mysql-community