Access denied for user 'root'@'localhost - Mysql - Linux Ubuntu
EDIT: I HAVE TRIED ALL THE OTHER TOPICS THAT IS ALREADY HERE ON STACKOVERFLOW, BUT I CANT FIX
When I try to do something here on MYSQL, I cant and the same shows me this message:
This when I click on "local instance 3306":
and this when i try to test a new connection
See also questions close to this topic
Endless Loop Of Update? Mysql Trigger
Even if i have inserted it inside an if statement with a var that contains zero value(if the qty/sku_stock is already equal), mysql still treat/sees it as an endless loop giving me an error of:
"Can't update table in stored function/trigger because it is already used by statement which invoked this stored function/trigger"
DELIMITER && create trigger after_update_db2_t1 after update on sample_db_two.product_inventory_tb for each row begin
set @qty_col_ctr = 0; if(new.qty != old.qty) then set @qty_col_ctr := 1; end if; if(@qty_col_ctr = 1) then update sample_db_one.products_sizes_tb set sku_stock = new.qty where sku_code=@sku_no; end if;
END&& DELIMITER ;
DELIMITER && create trigger after_update_db1_t1 after update on sample_db_one.products_sizes_tb for each row begin
set @qty_col_ctr = 0; if(new.sku_stock != old.sku_stock) then set @qty_col_ctr := 1; end if; if(@qty_col_ctr = 1) then update sample_db_two.product_inventory_tb set qty = new.sku_stock end if;
END&& DELIMITER ;
MySQL: Cumulative sum of seconds between consecutive dates
I'm trying in every way to solve this problem. I have a table with a column giving ID (NOT auto increment) and another one with TIMESTAMP data as you can see in the image.
I want to calculate the cumulative sum of the difference in seconds between the date in a row and the date in row+1 through all the table.
SELECT SUM(TIMESTAMPDIFF(SECOND, t1.time, t2.time)) as total FROM t_serie AS t1 INNER JOIN t_serie as t2 ON t2.id = t1.id +1
That's the query I'm using but it doesn't work since the id column isn't an auto increment value. How can I do this without using ALTER TABLE or adding a new column using auto increment id?
Thank you so much for the answer!
Kubernetes -- unable to connect to mysql from spring application
I have kubernetes cluster. I have started mysql from kubectl. I have a image of spring boot application. Im confused with the JDBC url to be used in application.yml. I have tried multiple IP addresses by describing pods, services etc. Its getting errored out with "communication Link failure"
Below is my mysql-deployment.yml
apiVersion: v1 kind: Service metadata: name: mysql spec: #type: NodePort ports: - port: 3306 #targetPort: 3306 #nodePort: 31000 selector: app: mysql clusterIP: None --- apiVersion: v1 kind: Secret metadata: name: mysql-secret type: Opaque data: MYSQL_ROOT_PASSWORD: cGFzc3dvcmQ= #password MYSQL_DATABASE: dGVzdA== #test MYSQL_USER: dGVzdHVzZXI= #testuser MYSQL_PASSWORD: dGVzdDEyMw== #test123 --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pv-claim spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: mysql spec: selector: matchLabels: app: mysql strategy: type: Recreate template: metadata: labels: app: mysql spec: containers: - image: mysql:5.7 name: mysql env: # Use secret in real usage - name: MYSQL_ROOT_PASSWORD valueFrom: secretKeyRef: name: mysql-secret key: MYSQL_ROOT_PASSWORD - name: MYSQL_DATABASE valueFrom: secretKeyRef: name: mysql-secret key: MYSQL_DATABASE - name: MYSQL_USER valueFrom: secretKeyRef: name: mysql-secret key: MYSQL_USER - name: MYSQL_PASSWORD valueFrom: secretKeyRef: name: mysql-secret key: MYSQL_PASSWORD ports: - containerPort: 3306 name: mysql volumeMounts: - name: mysql-persistent-storage mountPath: /var/lib/mysql volumes: - name: mysql-persistent-storage persistentVolumeClaim: claimName: mysql-pv-claim