Q: need your help Mysql ERROR I tried but failed: I am trying to run a app cloned from following repo
https://github.com/myogeshchavan97/fullstack_banking_app and stuck with mysql
I get following error when i run source /server/scripts.sql
I am using latest Server version: 8.0.23 Homebrew

*

*ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'bank_account' at line 1

*ERROR 1064 (42000): You
have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near
'BIGSERIAL PRIMARY KEY NOT NULL,   first_name VARCHAR(32) NOT NULL,
last_name V' at line 2

*ERROR 1064 (42000): You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'BIGSERIAL PRIMARY KEY NOT
NULL,   access_token VARCHAR(500) NOT NULL,   userid B' at line 2

scripts
CREATE DATABASE bank_account;

CREATE TABLE bank_user(
  userid BIGSERIAL PRIMARY KEY NOT NULL,
  first_name VARCHAR(32) NOT NULL,
  last_name VARCHAR(32) NOT NULL,
  email VARCHAR(32) NOT NULL,
  password VARCHAR(255) NOT NULL,
  unique(email)
);

CREATE TABLE TOKENS(
  id BIGSERIAL PRIMARY KEY NOT NULL,
  access_token VARCHAR(500) NOT NULL,
  userid BIGSERIAL NOT NULL,
  FOREIGN KEY(userid) REFERENCES bank_user(userid)
);

I get this error I tried with backticks as but unfortunately didn't work...I would appreciate your insight.

A: Try this:
CREATE TABLE bank_user( userid BIGINT PRIMARY KEY NOT NULL, first_name VARCHAR(32) NOT NULL, last_name VARCHAR(32) NOT NULL, email VARCHAR(32) NOT NULL, password VARCHAR(255) NOT NULL, unique(email) );

CREATE TABLE TOKENS( id BIGINT PRIMARY KEY NOT NULL, access_token VARCHAR(500) NOT NULL, userid BIGINT NOT NULL, FOREIGN KEY(userid) REFERENCES bank_user(userid) );

check the following link for mappings between PostgreSQL and MySQL.
In your case, instead of BIGSERIAL you need to use BIGINT.

A: The equivalent in MySQL would be:
CREATE TABLE bank_user (
  userid BIGINT AUTO_INCREMENT PRIMARY KEY,
  first_name VARCHAR(32) NOT NULL,
  last_name VARCHAR(32) NOT NULL,
  email VARCHAR(32) NOT NULL,
  password VARCHAR(255) NOT NULL,
  unique(email)
);

CREATE TABLE TOKENS (
  id BIGINT AUTO_INCREMENT PRIMARY KEY,
  access_token VARCHAR(500) NOT NULL,
  userid BIGINT NOT NULL,
  FOREIGN KEY (userid) REFERENCES bank_user(userid)
);

Here is a db<>fiddle.
The equivalent of SERIAL is AUTO_INCREMENT.
Some comments:

*

*32 characters may or may not be big enough for names.  It is certainly not big enough for emails, which can get pretty long.

*The password should be encrypted.  Do not store clear-text passwords in the data.

*I would be surprised if you really needed BIGINT for the userid.  Are you really planning on having billions of users?  A 4-byte integer should be sufficient.

*NOT NULL is redundant when you declare a column to be the primary key.

