mysql

Subquery returns more than 1 row - MySQL

。_饼干妹妹 提交于 2021-02-10 15:03:23
问题 UPDATE `pams_faker_lead_location` SET `location` = ( SELECT location FROM pams_leads WHERE pams_leads.location_id = pams_faker_lead_location.id ) I dont know when i run the query in Mysql , this error occur. #1242 - Subquery returns more than 1 row anyone can help me solve the problem ? 回答1: This query: SELECT location FROM pams_leads WHERE pams_leads.location_id = pams_faker_lead_location.id gives you more than 1 row. You must change something because if you need update value you need

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

你说的曾经没有我的故事 提交于 2021-02-10 14:51:21
问题 I am running a local mysql database on my computer using wampserver. I have made a c# console application that I want to use to update values in a table. However I am having issues connecting to the database. My password is an empty string. string user = "John Doe"; string queryString = "UPDATE users SET is_awesome=1 WHERE user=@a1"; string connectionString = "Server=localhost;Database=mydatabase;User Id=root;Password=;"; SqlConnection connection = new SqlConnection(connectionString);

How to select rows that have certain relationships through a pivot tabel?

放肆的年华 提交于 2021-02-10 14:50:39
问题 Sample database design USERS WORKDAYS DAYS [id] [name] [user_id] [day_id] [id] [name] 1 john 1 2 1 sunday 2 fred 1 3 2 monday 3 bert 1 4 3 tuesday 4 harry 1 5 4 wednesday 1 6 5 thursday 2 2 6 friday 4 1 7 saturday 4 2 4 3 4 4 4 5 4 6 4 7 How would I query Someone like John, who works exactly all workdays of the week: monday, tuesday, wednesday, thursday, friday Someone like Harry and John who works at least all those days? I work with mysql some time but I cannot find a solution at the moment

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

 ̄綄美尐妖づ 提交于 2021-02-10 14:49:20
问题 I am running a local mysql database on my computer using wampserver. I have made a c# console application that I want to use to update values in a table. However I am having issues connecting to the database. My password is an empty string. string user = "John Doe"; string queryString = "UPDATE users SET is_awesome=1 WHERE user=@a1"; string connectionString = "Server=localhost;Database=mydatabase;User Id=root;Password=;"; SqlConnection connection = new SqlConnection(connectionString);

How to select rows that have certain relationships through a pivot tabel?

拜拜、爱过 提交于 2021-02-10 14:49:12
问题 Sample database design USERS WORKDAYS DAYS [id] [name] [user_id] [day_id] [id] [name] 1 john 1 2 1 sunday 2 fred 1 3 2 monday 3 bert 1 4 3 tuesday 4 harry 1 5 4 wednesday 1 6 5 thursday 2 2 6 friday 4 1 7 saturday 4 2 4 3 4 4 4 5 4 6 4 7 How would I query Someone like John, who works exactly all workdays of the week: monday, tuesday, wednesday, thursday, friday Someone like Harry and John who works at least all those days? I work with mysql some time but I cannot find a solution at the moment

Creating a MySQL cluster, using mysql-server docker containers, on multiple servers

 ̄綄美尐妖づ 提交于 2021-02-10 14:46:32
问题 I'm trying to create an MySQL cluster of 3 nodes using mysql-server docker containers. I have 3 separate cloud instances and docker is setup on all 3 of them. Each server will have only 1 container running on it - to achieve High Availability when in cluster. I start the containers on all 3 servers, individually, with the command docker run --name=db -p 3301:3306 -v db:/var/lib/mysql -d mysql/mysql-server I'm mapping the port 3306 of container to my server's 3301 port . I've also created a

Creating a MySQL cluster, using mysql-server docker containers, on multiple servers

十年热恋 提交于 2021-02-10 14:46:16
问题 I'm trying to create an MySQL cluster of 3 nodes using mysql-server docker containers. I have 3 separate cloud instances and docker is setup on all 3 of them. Each server will have only 1 container running on it - to achieve High Availability when in cluster. I start the containers on all 3 servers, individually, with the command docker run --name=db -p 3301:3306 -v db:/var/lib/mysql -d mysql/mysql-server I'm mapping the port 3306 of container to my server's 3301 port . I've also created a

Cannot Grant select on mysql 8.0.17

允我心安 提交于 2021-02-10 14:35:27
问题 I want to grant select privilege to user from every host, but getting an error, you're not allow to create a user mysql> GRANT SELECT ON *.* TO 'alice'@'%' WITH GRANT OPTION; ERROR 1410 (42000): You are not allowed to create a user with GRANT I don't want to create a new user, for that I used command CREATE USER I tried to create a new user but the grant command also failed. 回答1: A good idea (and a good practice) in this MySql Version (8 and above) is to config ROLES and then set the users

Updating the summary table based on triggers and stored procedures

霸气de小男生 提交于 2021-02-10 14:30:55
问题 I have a typical LAMP based site + Zend Framework where I have a base table and a summary table. Summary table is used to display data in reports. Base table - ID | Status 1 | 1 2 | 1 3 | 2 4 | 2 5 | 1 6 | 1 Summary table - Status | Count 1 | 4 2 | 2 The base table will be changed(insert,update,delete) at an average of 20 times per day. Currently, I am using triggers to call a stored procedure which will update the summary table based on the base table. This is the stored procedure. CREATE

Updating the summary table based on triggers and stored procedures

扶醉桌前 提交于 2021-02-10 14:30:54
问题 I have a typical LAMP based site + Zend Framework where I have a base table and a summary table. Summary table is used to display data in reports. Base table - ID | Status 1 | 1 2 | 1 3 | 2 4 | 2 5 | 1 6 | 1 Summary table - Status | Count 1 | 4 2 | 2 The base table will be changed(insert,update,delete) at an average of 20 times per day. Currently, I am using triggers to call a stored procedure which will update the summary table based on the base table. This is the stored procedure. CREATE