Sql error 1054 sqlstate 42s22

Basically I am trying to make a simple promotion page, The error that I am getting is SQL Error: 1054, SQLState: 42S22 Error is Unknown column 'promotion0_.promo_type_id' in 'field list' Here ar...

Basically I am trying to make a simple promotion page, The error that I am getting is SQL Error: 1054, SQLState: 42S22 Error is Unknown column ‘promotion0_.promo_type_id’ in ‘field list’

Here are the model classes

package promotions.model;


import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="promotion")
public class Promotion implements Serializable{

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id")
private int id;
private String name;
private boolean active;
private boolean status;
@ManyToOne
@JoinColumn(name="promoType_id")
private Promo_Type promo_Type;
@ManyToOne
@JoinColumn(name="roomType_id")
private RoomType room_Types;



public Promotion() {

}
public Promotion(String name, boolean active, boolean status, Promo_Type promo_Type, RoomType room_Types) {
    super();
    this.name = name;
    this.active = active;
    this.status = status;
    this.promo_Type = promo_Type;
    this.room_Types = room_Types;
}
public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public boolean isActive() {
    return active;
}
public void setActive(boolean active) {
    this.active = active;
}
public boolean isStatus() {
    return status;
}
public void setStatus(boolean status) {
    this.status = status;
}
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "promoType_id")
public Promo_Type getPromo_Type() {
    return promo_Type;
}

public void setPromo_Type(Promo_Type promo_Type) {
    this.promo_Type = promo_Type;
}

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "roomType_id")
public RoomType getRoom_Types() {
    return room_Types;
}
public void setRoom_Types(RoomType room_Types) {
    this.room_Types = room_Types;
}
@Override
public String toString() {
    return "Promotions [id=" + id + ", name=" + name + ", active=" + active + ", status=" + status + ", promo_Type="
            + promo_Type + ", room_Types=" + room_Types + "]";
}

}

package promotions.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="roomType")
public class RoomType implements Serializable{

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="roomType_id")
private int id;
private String name;

@OneToMany(mappedBy="room_Types", cascade= CascadeType.ALL,fetch= FetchType.LAZY)
private Collection<Promotion>promotions;




public RoomType() {

}

public RoomType(String name, Collection<Promotion> promotions) {
    super();
    this.name = name;
    this.promotions = promotions;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public Collection<Promotion> getPromotions() {
    return promotions;
}

public void setPromotions(Collection<Promotion> promotions) {
    this.promotions = promotions;
}






}

here is another model class

package promotions.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;


@Entity
@Table(name="promoType")
public class Promo_Type implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="promoType_id")
private int id;
private String name;
private double discount;
@OneToMany(mappedBy="promo_Type", cascade= CascadeType.ALL,fetch= FetchType.LAZY)
private Collection<Promotion>promotions;



public Promo_Type() {

}
public Promo_Type(String name, double discount, Collection<Promotion>      promotions) {
    super();
    this.name = name;
    this.discount = discount;
    this.promotions = promotions;
}
public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public double getDiscount() {
    return discount;
}
public void setDiscount(double discount) {
    this.discount = discount;
}
public Collection<Promotion> getPromotions() {
    return promotions;
}
public void setPromotions(Collection<Promotion> promotions) {
    this.promotions = promotions;
}

}

and here is the mysql query

 CREATE DATABASE `promotiondb`;

use promotiondb;

CREATE TABLE `promoType` (
  `promoType_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `discount` DOUBLE NOT NULL,
  PRIMARY KEY (`promoType_id`)
);


CREATE TABLE `roomType` (
  `roomType_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(70) NOT NULL,
   PRIMARY KEY (`roomType_id`)
);

CREATE TABLE `promotion` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(45) NULL,
  `status` TINYINT(1) NULL,
  `active` TINYINT(1) NULL,
  `promoType_id` int(11) NOT NULL,
  `roomType_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_promoType` (`promoType_id`),
  KEY `fk_roomType` (`roomType_id`),
  CONSTRAINT `fk_roomType` FOREIGN KEY (`roomType_id`) REFERENCES `roomType` (`roomType_id`),
  CONSTRAINT `fk_promoType` FOREIGN KEY (`promoType_id`) REFERENCES `promoType` (`promoType_id`)
);

Here is the error, SQL Error: 1054, SQLState: 42S22, Unknown column ‘promotion0_.promo_type_id’ in ‘field list’ERROR 34768 — [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : Unknown column ‘promotion0_.promo_type_id’ in ‘field list’

    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'promotion0_.promo_type_id' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_121]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_121]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_121]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1966) ~[mysql-connector-java-5.1.41-bin.jar:5.1.41]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.getResultSet(Loader.java:2117) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1900) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:919) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2617) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2600) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.Loader.list(Loader.java:2424) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1326) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:50) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:329) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:74) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.sun.proxy.$Proxy83.findAll(Unknown Source) ~[na:na]
at promotions.service.PromotionsService.findAll(PromotionsService.java:28) ~[classes/:na]
at promotions.service.PromotionsService$$FastClassBySpringCGLIB$$f95c210e.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at promotions.service.PromotionsService$$EnhancerBySpringCGLIB$$30594b1.findAll(<generated>) ~[classes/:na]
at promotions.controller.SampleRestController.allpromotions(SampleRestController.java:24) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.5.6-dev]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[catalina.jar:na]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[catalina.jar:na]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [catalina.jar:na]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:na]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:na]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:na]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [catalina.jar:na]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-coyote.jar:8.5.6-dev]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.6-dev]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-coyote.jar:8.5.6-dev]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-coyote.jar:8.5.6-dev]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.6-dev]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_121]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.6-dev]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_121]

If you’re getting an error that reads something like “ERROR 1054 (42S22): Unknown column ‘tab.ColName’ in ‘on clause”” in MariaDB, here are three likely causes:

  • The column doesn’t exist.
  • You’re trying to reference an aliased column by its column name.
  • Or it could be the other way around. You could be referencing the column with an alias that was never declared.

If a column has an alias, then you must use that alias when referencing it in any ON clause when doing a join against two or more tables. Conversely, if you reference a column by an alias, then you need to ensure that the alias is actually declared in the first place.

Example 1

Here’s an example of code that produces the error:

SELECT 
    c.CatId,
    c.CatName
FROM Cats c
INNER JOIN Dogs d
ON c.DogName = d.DogName;

Result:

ERROR 1054 (42S22): Unknown column 'c.DogName' in 'on clause'

Here I accidentally used c.DogName in the ON clause when I meant to use c.CatName.

In this case, the fix is simple. Use the correct column name:

SELECT 
    c.CatId,
    c.CatName
FROM Cats c
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Example 2

Here’s another example of code that produces the error:

SELECT 
    CatId,
    CatName
FROM Cats
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Result:

ERROR 1054 (42S22): Unknown column 'c.CatName' in 'on clause'

Here I referenced a non-existent alias in the ON clause. I used c.CatName to refer to the CatName column in the Cats table. The only problem is that the Cats table doesn’t have an alias.

To fix this issue, all we have to do is provide an alias for the Cats table:

SELECT 
    CatId,
    CatName
FROM Cats c
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Alternatively, we could remove all references to the alias, and just use the full table name:

SELECT 
    CatId,
    CatName
FROM Cats
INNER JOIN Dogs
ON Cats.CatName = Dogs.DogName;

One thing I should point out is that, in this example we didn’t prefix the column names in the SELECT list with the alias. If we had done that, we would have seen the same error, but with a slightly different message:

SELECT 
    c.CatId,
    c.CatName
FROM Cats
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Result:

ERROR 1054 (42S22): Unknown column 'c.CatId' in 'field list'

In this case, it detected the unknown columns in the field list before it found the one in the ON clause. Either way, the solution is the same.

Example 3

Here’s another example of code that produces the error:

SELECT 
    c.CatId,
    c.CatName
FROM Cats c
INNER JOIN Dogs d
ON Cats.CatName = d.DogName;

Result:

ERROR 1054 (42S22): Unknown column 'Cats.CatName' in 'on clause'

In this case, an alias was declared for the Cats table, but I didn’t use that alias in the ON clause.

The solution here, is to use the alias instead of the table name:

SELECT 
    c.CatId,
    c.CatName
FROM Cats c
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Дата: 25.11.2013

Автор: Даниил Каменский , dkamenskiy (at) yandex (dot) ru

При использовании ряда CMS (например, DLE, vBulletin и др.) временами возникает ошибка mysql с номером 1054.

Текст ошибки Unknown column ‘ИМЯ_СТОЛБЦА’ in ‘field list’ в переводе означает «Неизвестный столбец ‘ИМЯ_СТОЛБЦА’ в списке полей.«. Такая ошибка возникает в том случае, если попытаться выбрать (запрос вида select) или изменить (запрос вида update) данные из столбца, которого не существует. Ошибка чаще всего возникает из-за стoронних модулей. Перечислим несколько возможных причин:

  • установлен модуль, расчитанный на более новую версию CMS, чем используемая;
  • при установке модуля не выполнились операции изменения структуры таблиц;
  • после установки сторонних модулей выполнено обновление системы, которое привело к изменению структуры таблиц; при этом модуль не был обновлен на совместимый;
  • Из резервной копии восстановлена более старая база данных, а файлы сайта остались в новой версии.

Пример №1:
Имеется таблица сотрудников подразделения.
Поля: id, фамилия, имя, отчество, год рождения, наличие высшего образования.

create table if not exists employee
(
`id` int(11) NOT NULL auto_increment primary key,
`surname` varchar(255) not null,
`name` varchar(255) not null,
`patronymic` varchar(255) not null,
`year_of_birth` int unsigned default 0,
`higher_education` tinyint unsigned default 0
) ENGINE=MyISAM;
 

Если обратиться к этой таблице с запросом на выборку несуществующего поля, например пола сотрудника по фамилии Власенко, то результатом будет вышеуказанная ошибка:

mysql> select sex from employee where surname=’Власенко’;

ERROR 1054 (42S22): Unknown column ‘sex’ in ‘field list’

Пример №2:
Воспользуемся той же таблицей из примера 1. Если попытаться указать мужской пол у сотрудника по имени Власенко (выяснилось его имя и стало ясно, что это мужчина), то результатом будет та же ошибка:

mysql> update employee set sex=1 where surname=’Власенко’;

ERROR 1054 (42S22): Unknown column ‘sex’ in ‘field list’

Способы борьбы

Самый корректный способ борьбы в устранении причины ошибки. Например, все обновления сайта рекомендуем выполнять сначала на копии сайта и если ошибок нет, то повторять на рабочем сайте. Если при обновлении возникла ошибка, следует найти способ сделать обновление корректно с учетом версий сторонних модулей.

Если по каким-то причинам корректно избежать ошибки не получилось, можно прибегнуть к симптоматическому лечению, которое состоит в простом добавлении недостающих полей в таблицу.

Запрос на добавление:

ALTER TABLE employee ADD COLUMN sex ENUM(‘male’, ‘female’) DEFAULT ‘female’
 

Что в переводе означает «Изменить таблицу employee, добавив столбец `пол`, назначив ему тип перечисление(мужской/женский) по умолчанию мужской».

При таком добавлении столбца необходимо учитывать, что у всех записей в таблице в столбце sex появится значение по умолчанию. Если добавлять такой столбец как пол (который не может быть равен null и обязательно присутствует у каждого человека), то просто необходимо сразу же
после этого прописать нужное значение во все записи в таблице. В данном случае с добавлением столбца «пол» нужно будет поменять значение на male у всех сотрудников мужского пола.

Трудности могут возникнуть из-за того, что часто нужно самостоятельно определять тип добавляемого столбца.

Примеры:

a) Запрос:

SELECT faqname, faqparent, displayorder, volatile FROM faq where product
IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);

Ответ сервера:

Invalid SQL: SELECT faqname, faqparent, displayorder, volatile FROM faq where
product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);


MySQL Error: Unknown column ‘faqname’ in ‘field list’

Error Number: 1054

Отсутствует столбец faqname, добавим его. Логика подсказывает, что если имя — то это скорее всего символы, а не целое число или тип datetime. Количество символов заранее, конечно, неизвестно, но редко имя бывает больше чем 255 символов. Поэтому добавим столбец faqname с указанием типа varchar(255):

ALTER TABLE faq ADD faqname varchar(255)

б) Запроc:

UPDATE dle_usergroups set group_name=‘Журналисты’, allow_html=‘0’ WHERE id=‘3’;

Ответ сервера:

Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_html=’0′ WHERE id=’3′;

MySQL Error: Unknown column ‘allow_html’ in ‘field list’

Error Number: 1054

Отсутствует столбец allow_html, добавим его. Смотрим на то значение, которое туда пытается вставить запрос, видим 0. Скорее всего этот столбец может принимать два значения — разрешить/не разрешить (1 или 0), то есть однобайтное целое число вполне подойдёт. Поэтому добавим столбец allow_html с указанием типа tinyint:

ALTER TABLE faq ADD allow_html tinyint

Таким образом можно составить шаблон для «лечения» таких проблем: ALTER TABLE [a] ADD [b] [c];, где

a — имя таблицы, откуда выбираются (или где обновляются) данные;

b — имя столбца, который нужно добавить;

c — тип данных.

Примеры (во всех примерах идёт работа с таблицей dle_usergroups):

1) Запрос:

UPDATE dle_usergroups set group_name=‘Журналисты’, allow_html=‘0’ WHERE id=‘3’;

Ответ сервера:

Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_html=’0′ WHERE id=’3′;

MySQL Error: Unknown column ‘allow_html’ in ‘field list’

Error Number: 1054

Решение:

a=dle_usergroups, b=allow_html, c=tinyint, то есть

ALTER TABLE dle_usergroups ADD allow_html tinyint

Для того, чтобы выполнить исправляющий ошибку запрос, необходимо воспользоваться каким-либо mysql-клиентом. В стандартной поставке mysql всегда идёт консольный клиент с названием mysql (в windows mysql.exe). Для того, чтобы подключиться к mysql выполните команду

mysql -hНАЗВАНИЕ_ХОСТА -uИМЯ_ПОЛЬЗОВАТЕЛЯ -pПАРОЛЬ ИМЯ_БАЗЫ_ДАННЫХ,

после чего введите необходимый запрос и точку с запятой после него в появившейся командной строке.

В том случае, если работа происходит на чужом сервере (например, арендуется хостинг) и нет возможности воспользоваться mysql-клиентом из командной строки (не всегда хостеры представляют такую возможность), можно воспользоваться тем инструментом, который предоставляет хостер — например, phpMyAdmin, и в нём ввести нужный sql-запрос.

В то же время наиболее подходящий инструмент для работы с mysql — это MySQL Workbench — разработка создателей mysql с достаточно удобным пользовательским интерфейсом.

Если же нет возможности подключиться к mysql напрямую (например из-за ограничений файрвола), то в ряде случаев возможно удалённо подключиться к MySQL-серверу через SSH-туннель.

2) Запрос:

UPDATE dle_usergroups set group_name=‘Журналисты’, allow_subscribe=‘0’ WHERE id=‘3’;

Ответ сервера:

Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_subscribe=’0′ WHERE id=’3′;

MySQL Error: Unknown column ‘allow_subscribe’ in ‘field list’

Error Number: 1054

Решение:
a=dle_usergroups, b=allow_subscribe, c=tinyint, то есть

ALTER TABLE dle_usergroups ADD allow_subscribe tinyint

3) Запрос:

SELECT faqname, faqparent, displayorder, volatile FROM faq where product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);

Oтвет сервера:

InvalidSQL: SELECT faqname, faqparent, displayorder, volatile FROM faq where product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);

MySQL Error: Unknown column ‘faqname’ in ‘field list’

Error Number: 1054

Решение:
a= faq, b=faqname, c=varchar(255), то есть

ALTER TABLE faq ADD faqname varchar(255)

Результат

В результате добавления необходимого поля ошибка должна исчезнуть. Однако, существует вероятность того, что в структуре таблиц не хватало несколько столбцов: в этом случае ошибка повторится с указанием другого имени столбца, для которого потребуется повторить процедуру. Помните, что добавление незаполненных столбцов угаданного типа не всегда будет соответствовать задуманной логике приложения и может нарушить часть функциональности.

Источник: webew.ru

Дата публикации: 25.11.2013

© Все права на данную статью принадлежат порталу SQLInfo.ru. Перепечатка в интернет-изданиях разрешается только с указанием автора и прямой ссылки на оригинальную статью. Перепечатка в бумажных изданиях допускается только с разрешения редакции.

When you execute a MySQL statement, you may sometimes encounter ERROR 1054 as shown below:

mysql> SELECT user_name FROM users;
ERROR 1054 (42S22): Unknown column 'user_name' in 'field list'

The ERROR 1054 in MySQL occurs because MySQL can’t find the column or field you specified in your statement.

This error can happen when you execute any valid MySQL statements like a SELECT, INSERT, UPDATE, or ALTER TABLE statement.

This tutorial will help you fix the error by adjusting your SQL statements.

Let’s start with the SELECT statement.

Fix ERROR 1054 on a SELECT statement

To fix the error in your SELECT statement, you need to make sure that the column(s) you specified in your SQL statement actually exists in your database table.

Because the error above says that user_name column is unknown, let’s check the users table and see if the column exists or not.

To help you check the table in question, you can use the DESCRIBE or EXPLAIN statement to show your table information.

The example below shows the output of EXPLAIN statement for the users table:

mysql> EXPLAIN users;
+--------------+-------------+------+-----+---------+-------+
| Field        | Type        | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| username     | varchar(25) | NO   |     |         |       |
| display_name | varchar(50) | NO   |     |         |       |
| age          | int         | YES  |     | NULL    |       |
| comments     | text        | YES  |     | NULL    |       |
+--------------+-------------+------+-----+---------+-------+

From the result above, you can see that the users table has no user_name field (column)

Instead, it has the username column without the underscore.

Knowing this, I can adjust my previous SQL query to fix the error:

SELECT username FROM users;

That should fix the error and your SQL query should show the result set.

Fix ERROR 1054 on an INSERT statement

When you specify column names in an INSERT statement, then the error can be triggered on an INSERT statement because of a wrong column name, just like in the SELECT statement.

First, you need to check that you have the right column names in your statement.

Once you are sure, the next step is to look at the VALUES() you specified in the statement.

For example, when I ran the following statement, I triggered the 1054 error:

mysql> INSERT INTO users(username, display_name) 
    ->   VALUES ("jackolantern", Jack);
ERROR 1054 (42S22): Unknown column 'Jack' in 'field list'

The column names above are correct, and the error itself comes from the last entry in the VALUES() function.

The display_name column is of VARCHAR type, so MySQL expects you to insert a VARCHAR value into the column.

But Jack is not a VARCHAR value because it’s not enclosed in a quotation mark. MySQL considers the value to be a column name.

To fix the error above, simply add a quotation mark around the value. You can use both single quotes or double quotes as shown below:

INSERT INTO users(username, display_name) 
  VALUES ("jackolantern", 'Jack');

Now the INSERT statement should run without any error.

Fix ERROR 1054 on an UPDATE statement

To fix the 1054 error caused by an UPDATE statement, you need to look into the SET and WHERE clauses of your statement and make sure that the column names are all correct.

You can look at the error message that MySQL gave you to identify where the error is happening.

For example, the following SQL statement:

UPDATE users
SET username = "jackfrost", display_name = "Jack Frost"
WHERE user_name = "jackolantern";

Produces the following error:

ERROR 1054 (42S22): Unknown column 'user_name' in 'where clause'

The error clearly points toward the user_name column in the WHERE clause, so you only need to change that.

If the error points toward the field_list as shown below:

ERROR 1054 (42S22): Unknown column 'displayname' in 'field list'

Then you need to check on the SET statement and make sure that:

  • You have the right column names
  • Any string type values are enclosed in a quotation mark

You can also check on the table name that you specified in the UPDATE statement and make sure that you’re operating on the right table.

Next, let’s look at how to fix the error on an ALTER TABLE statement

Fix ERROR 1054 on an ALTER TABLE statement

The error 1054 can also happen on an ALTER TABLE statement.

For example, the following statement tries to rename the displayname column to realname:

ALTER TABLE users 
  RENAME COLUMN displayname TO realname;

Because there’s no displayname column name in the table, MySQL will respond with the ERROR 1054 message.

Conclusion

In short, ERROR 1054 means that MySQL can’t find the column name that you specified in your SQL statements.

It doesn’t matter if you’re writing an INSERT, SELECT, or UPDATE statement.

There are only two things you need to check to fix the error:

  • Make sure you’ve specified the right column name in your statement
  • Make sure that any value of string type in your statement is surrounded by a quotation mark

You can check on your table structure using the DESCRIBE or EXPLAIN statement to help you match the column name and type with your statement.

And that’s how you fix the MySQL ERROR 1054 caused by your SQL statements.

I hope this tutorial has been useful for you 🙏

SQL Error: 1054, SQLState: 42S22 this is the Error caused by the missing field, first attach the Error log:

2020-03-04 10:30:00. 221 WARN [pool – 8 – thread – 1] [org. Hibernate. Engine. JDBC. Spi. SqlExceptionHelper. Java: 127] – SQL Error: 1054, SQLState: 42 s22
the 2020-03-04 10:30:00. 221 ERROR [pool – 8 – thread – 1] [org. Hibernate. Engine. JDBC. Spi. SqlExceptionHelper. Java: 129] – Unknown column ‘markcardex0_. Art_service_time’ in ‘field List ‘
the 2020-03-04 10:30:00. 225 ERROR [pool – 8 – thread – 1] [org. Springframework. Scheduling. Support. TaskUtils $LoggingErrorHandler. Java: 95] – Unexpected ERROR occurred in scheduled task.
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; Nested exception is org. Hibernate. Exception….

under Caused by: org. Hibernate. Exception. SQLGrammarException: could not extract the ResultSet
… 24 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column ‘markcardex0_. Art_service_time’ in ‘the field list’
the at sun, reflect the NativeConstructorAccessorImpl. NewInstance0 (Native Method)
the at Sun. Reflect. NativeConstructorAccessorImpl. NewInstance (NativeConstructorAccessorImpl. Java: 62)
the at Sun. Reflect. DelegatingConstructorAccessorImpl. NewInstance (DelegatingConstructorAccessorImpl. Java: 45)
the at Java lang. Reflect. Constructor. NewInstance (423) Constructor. Java:
the at Com. Mysql. JDBC. Util. HandleNewInstance Util. Java: (411)
at the mysql. JDBC. Util. GetInstance (Util. Java: 386)
at the mysql. JDBC. SQLError. CreateSQLException (SQLError. Java: 1053)
the at Com. Mysql. JDBC. MysqlIO. CheckErrorPacket MysqlIO. Java: (4074)
at the mysql. JDBC. MysqlIO. CheckErrorPacket (MysqlIO. Java: 4006)
at the mysql. JDBC. MysqlIO. SendCommand (MysqlIO. Java: 2468)
At com. Mysql. JDBC. MysqlIO. SqlQueryDirect (MysqlIO. Java: 2629)
at the mysql. JDBC. ConnectionImpl. ExecSQL (ConnectionImpl. Java: 2719)
the at . Com. Mysql. JDBC PreparedStatement. ExecuteInternal (PreparedStatement. Java: 2155)
at the mysql.. JDBC PreparedStatement. ExecuteQuery (2318) a PreparedStatement. Java:
the at Com. Alibaba. Druid. Filter. FilterChainImpl. PreparedStatement_executeQuery (FilterChainImpl. Java: 2714)
the at Com. Alibaba. Druid. Filter. FilterEventAdapter. PreparedStatement_executeQuery (FilterEventAdapter. Java: 465)
the at Com. Alibaba. Druid. Filter. FilterChainImpl. PreparedStatement_executeQuery (FilterChainImpl. Java: 2711)
the at Com. Alibaba. Druid. Proxy. JDBC. PreparedStatementProxyImpl. ExecuteQuery (PreparedStatementProxyImpl. Java: 145)
the at Com. Alibaba. Druid. Pool. DruidPooledPreparedStatement. ExecuteQuery (DruidPooledPreparedStatement. Java: 227)
the at Org. Hibernate. Engine. JDBC. Internal. ResultSetReturnImpl. Extract (ResultSetReturnImpl. Java: 70)
… 60 common frames omitted

error occurs mainly because the variables in the entity class do not match the classes in the database table, which is a headache, especially when the data is complex. I used to be stupid, one by one, but now I can sum up a simple method:

1. Look at the reason for this error: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column ‘markcardex0_. Art_service_time ‘in ‘field List’ is Unknown column ‘markcardex0_. Art_service_time ‘in ‘field list’ is Unknown column’ mark_service_time ‘in ‘field list’ Find –> Find In Path) quickly search artServiceTime, Find the entity class that defines the variable artServiceTime, click In, as follows:

2. After entering the entity class corresponding to this variable, you can see the database Table corresponding to this entity through the annotation @table (name = “uk_markcard_xxxx”) :

opens the database and verifies the existence of this attribute in the table through the query, as follows:

as shown in the figure above, we found the same error as the console, at this time we add the corresponding entity variable property on the table, note:

(1) attribute type must be the same as the entity variable type

(2) MySQL makes no case difference, but if the variable in the entity class is named aaaBcc, the attribute name in the database should be aaa_bcc, not

Read More:

I had similar error during CREATE USER query.

I did following solution to rectify the user table.

ALTER TABLE `user` ADD `Create_tablespace_priv` ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER `Trigger_priv`; 
ALTER TABLE `user` ADD `plugin` CHAR(64) NULL AFTER `max_user_connections`; 
ALTER TABLE `user` ADD `authentication_string` TEXT NULL DEFAULT NULL AFTER `plugin`; 
ALTER TABLE `user` ADD `password_expired` ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER `authentication_string`; 

Now CREATE USER query works fine.!!

Rectification is achieved from the reference of the answer to Cannot GRANT privileges as root.
Thank you RolandoMySQLDBA.!

Following helped to create above SQL:

+------------------------+------------------------+-----------------------------------+------+-----+---------+
| Field (MySQL 5.1)      | Field (MySQL 5.6)      | Type                              | Null | Key | Default |
+------------------------+------------------------+-----------------------------------+------+-----+---------+
| Host                   | Host                   | char(60)                          | NO   | PRI |         |
| User                   | User                   | char(16)                          | NO   | PRI |         |
| Password               | Password               | char(41)                          | NO   |     |         |
| Select_priv            | Select_priv            | enum('N','Y')                     | NO   |     | N       |
| Insert_priv            | Insert_priv            | enum('N','Y')                     | NO   |     | N       |
| Update_priv            | Update_priv            | enum('N','Y')                     | NO   |     | N       |
| Delete_priv            | Delete_priv            | enum('N','Y')                     | NO   |     | N       |
| Create_priv            | Create_priv            | enum('N','Y')                     | NO   |     | N       |
| Drop_priv              | Drop_priv              | enum('N','Y')                     | NO   |     | N       |
| Reload_priv            | Reload_priv            | enum('N','Y')                     | NO   |     | N       |
| Shutdown_priv          | Shutdown_priv          | enum('N','Y')                     | NO   |     | N       |
| Process_priv           | Process_priv           | enum('N','Y')                     | NO   |     | N       |
| File_priv              | File_priv              | enum('N','Y')                     | NO   |     | N       |
| Grant_priv             | Grant_priv             | enum('N','Y')                     | NO   |     | N       |
| References_priv        | References_priv        | enum('N','Y')                     | NO   |     | N       |
| Index_priv             | Index_priv             | enum('N','Y')                     | NO   |     | N       |
| Alter_priv             | Alter_priv             | enum('N','Y')                     | NO   |     | N       |
| Show_db_priv           | Show_db_priv           | enum('N','Y')                     | NO   |     | N       |
| Super_priv             | Super_priv             | enum('N','Y')                     | NO   |     | N       |
| Create_tmp_table_priv  | Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N       |
| Lock_tables_priv       | Lock_tables_priv       | enum('N','Y')                     | NO   |     | N       |
| Execute_priv           | Execute_priv           | enum('N','Y')                     | NO   |     | N       |
| Repl_slave_priv        | Repl_slave_priv        | enum('N','Y')                     | NO   |     | N       |
| Repl_client_priv       | Repl_client_priv       | enum('N','Y')                     | NO   |     | N       |
| Create_view_priv       | Create_view_priv       | enum('N','Y')                     | NO   |     | N       |
| Show_view_priv         | Show_view_priv         | enum('N','Y')                     | NO   |     | N       |
| Create_routine_priv    | Create_routine_priv    | enum('N','Y')                     | NO   |     | N       |
| Alter_routine_priv     | Alter_routine_priv     | enum('N','Y')                     | NO   |     | N       |
| Create_user_priv       | Create_user_priv       | enum('N','Y')                     | NO   |     | N       |
| Event_priv             | Event_priv             | enum('N','Y')                     | NO   |     | N       |
| Trigger_priv           | Trigger_priv           | enum('N','Y')                     | NO   |     | N       |
|                        | Create_tablespace_priv | enum('N','Y')                     | NO   |     | N       |
| ssl_type               | ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |         |
| ssl_cipher             | ssl_cipher             | blob                              | NO   |     | NULL    |
| x509_issuer            | x509_issuer            | blob                              | NO   |     | NULL    |
| x509_subject           | x509_subject           | blob                              | NO   |     | NULL    |
| max_questions          | max_questions          | int(11) unsigned                  | NO   |     | 0       |
| max_updates            | max_updates            | int(11) unsigned                  | NO   |     | 0       |
| max_connections        | max_connections        | int(11) unsigned                  | NO   |     | 0       |
| max_user_connections   | max_user_connections   | int(11) unsigned                  | NO   |     | 0       |
|                        | plugin                 | char(64)                          | YES  |     |         |
|                        | authentication_string  | text                              | YES  |     | NULL    |
|                        | password_expired       | enum('N','Y')                     | NO   |     | N       |
+------------------------+------------------------+-----------------------------------+------+-----+---------+

Hi Brandon, Sorry for the delay in getting this to you.

Next yiidbException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dateDeleted' in 'where clause'
The SQL being executed was: SELECT `elements`.`id`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`slug`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `content`.`id` AS `contentId`, `content`.`title`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`, `structureelements`.`structureId`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId`, `structureelements`.`structureId`
FROM `craft_elements` `elements`
INNER JOIN `craft_entries` `entries` ON `entries`.`id` = `elements`.`id`
INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
INNER JOIN `craft_content` `content` ON `content`.`elementId` = `elements`.`id`
LEFT JOIN `craft_structureelements` `structureelements` ON (`structureelements`.`elementId` = `elements`.`id`) AND (EXISTS (SELECT *
FROM `craft_structures`
WHERE (`id` = `structureelements`.`structureId`) AND (`dateDeleted` IS NULL)))
WHERE (`elements_sites`.`siteId`=1) AND (`content`.`siteId`=1) AND (`elements`.`id`=2) AND (`elements`.`archived`=FALSE)
ORDER BY `structureelements`.`lft`, `entries`.`postDate` DESC
LIMIT 1) `subquery`
INNER JOIN `craft_entries` `entries` ON `entries`.`id` = `subquery`.`elementsId`
INNER JOIN `craft_elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
INNER JOIN `craft_content` `content` ON `content`.`id` = `subquery`.`contentId`
LEFT JOIN `craft_structureelements` `structureelements` ON (`structureelements`.`elementId` = `subquery`.`elementsId`) AND (`structureelements`.`structureId` = `subquery`.`structureId`)
ORDER BY `structureelements`.`lft`, `entries`.`postDate` DESC in /Sites/c3computers/vendor/yiisoft/yii2/db/Schema.php:664
#0 /Sites/c3computers/vendor/yiisoft/yii2/db/Command.php(1295): yiidbSchema->convertException(Object(PDOException), 'SELECT `element...')
#1 /Sites/c3computers/vendor/yiisoft/yii2/db/Command.php(1158): yiidbCommand->internalExecute('SELECT `element...')
#2 /Sites/c3computers/vendor/yiisoft/yii2/db/Command.php(413): yiidbCommand->queryInternal('fetch', NULL)
#3 /Sites/c3computers/vendor/yiisoft/yii2/db/Query.php(274): yiidbCommand->queryOne()
#4 /Sites/c3computers/vendor/craftcms/cms/src/db/Query.php(177): yiidbQuery->one(NULL)
#5 /Sites/c3computers/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1215): craftdbQuery->one(NULL)
#6 /Sites/c3computers/vendor/craftcms/cms/src/services/Elements.php(215): craftelementsdbElementQuery->one()
#7 /Sites/c3computers/vendor/craftcms/cms/src/services/Elements.php(272): craftservicesElements->getElementById(2, 'craft\elements\...', 1)
#8 /Sites/c3computers/vendor/nystudio107/craft-seomatic/src/services/MetaContainers.php(801): craftservicesElements->getElementByUri('__home__', 1, false)
#9 /Sites/c3computers/vendor/nystudio107/craft-seomatic/src/services/MetaContainers.php(157): nystudio107seomaticservicesMetaContainers->setMatchedElement('', '1')
#10 /Sites/c3computers/vendor/nystudio107/craft-seomatic/src/twigextensions/SeomaticTwigExtension.php(47): nystudio107seomaticservicesMetaContainers->loadMetaContainers('', NULL)
#11 /Sites/c3computers/vendor/twig/twig/src/ExtensionSet.php(326): nystudio107seomatictwigextensionsSeomaticTwigExtension->getGlobals()
#12 /Sites/c3computers/vendor/twig/twig/src/Environment.php(939): TwigExtensionSet->getGlobals()
#13 /Sites/c3computers/vendor/twig/twig/src/Environment.php(959): TwigEnvironment->getGlobals()
#14 /Sites/c3computers/vendor/twig/twig/src/Template.php(359): TwigEnvironment->mergeGlobals(Array)
#15 /Sites/c3computers/vendor/craftcms/cms/src/web/twig/Template.php(34): TwigTemplate->display(Array, Array)
#16 /Sites/c3computers/vendor/twig/twig/src/Template.php(367): craftwebtwigTemplate->display(Array)
#17 /Sites/c3computers/vendor/twig/twig/src/TemplateWrapper.php(45): TwigTemplate->render(Array, Array)
#18 /Sites/c3computers/vendor/twig/twig/src/Environment.php(318): TwigTemplateWrapper->render(Array)
#19 /Sites/c3computers/vendor/craftcms/cms/src/web/View.php(343): TwigEnvironment->render('_special/dbupda...', Array)
#20 /Sites/c3computers/vendor/craftcms/cms/src/web/View.php(393): craftwebView->renderTemplate('_special/dbupda...', '[]')
#21 /Sites/c3computers/vendor/craftcms/cms/src/web/Controller.php(161): craftwebView->renderPageTemplate('_special/dbupda...', '[]')
#22 /Sites/c3computers/vendor/craftcms/cms/src/controllers/TemplatesController.php(105): craftwebController->renderTemplate('_special/dbupda...')
#23 [internal function]: craftcontrollersTemplatesController->actionManualUpdateNotification()
#24 /Sites/c3computers/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#25 /Sites/c3computers/vendor/yiisoft/yii2/base/Controller.php(157): yiibaseInlineAction->runWithParams(Array)
#26 /Sites/c3computers/vendor/craftcms/cms/src/web/Controller.php(109): yiibaseController->runAction('manual-update-n...', Array)
#27 /Sites/c3computers/vendor/yiisoft/yii2/base/Module.php(528): craftwebController->runAction('manual-update-n...', Array)
#28 /Sites/c3computers/vendor/craftcms/cms/src/web/Application.php(297): yiibaseModule->runAction('templates/manua...', Array)
#29 /Sites/c3computers/vendor/craftcms/cms/src/web/Application.php(672): craftwebApplication->runAction('templates/manua...')
#30 /Sites/c3computers/vendor/craftcms/cms/src/web/Application.php(223): craftwebApplication->_processUpdateLogic(Object(craftwebRequest))
#31 /Sites/c3computers/vendor/yiisoft/yii2/base/Application.php(386): craftwebApplication->handleRequest(Object(craftwebRequest))
#32 /Sites/c3computers/public/index.php(22): yiibaseApplication->run()
#33 /Users/andrew/.composer/vendor/laravel/valet/server.php(151): require('/Sites/c3comput...')
#34 {main}

web.log

Понравилась статья? Поделить с друзьями:
  • Spring json error response
  • Sql error code 18456
  • Sql error code 1215 cannot add foreign key constraint
  • Sql error code 1175
  • Sql error code 1052