Create Database Tables
In this video series you can see how to connect Ozeki SMS Gateway and MySQL database server for SMS messaging. This video shows how to create the proper database table structure by using the command line of MySQL.
Video content1. Connect to MySQL
2. Copy CREATE TABLE statement
Please scroll down to copy the SQL statements (Figure 1) used in the video. If you have created the database in MySQL, you can jump to the next video.
The first step is to open MySQL Shell. To do that, please search for the icon you see on Figure 1. Click on it to run the program.
Now if you have the program opened, please copy the code, you can see on Figure 3. You can see that we have pasted the code, and it has created our database, on Figure 2.
MySQL CREATE TABLE statements to copy:
CREATE DATABASE ozekidb;Figure 3 - Create database statement
MySQL CREATE TABLE statements to copy:
CREATE TABLE ozekimessagein ( id int(11) NOT NULL auto_increment, sender varchar(255) default NULL, receiver varchar(255) default NULL, msg text default NULL, senttime varchar(100) default NULL, receivedtime varchar(100) default NULL, operator varchar(100) default NULL, msgtype varchar(160) default NULL, reference varchar(100) default NULL, PRIMARY KEY (id) ) charset=utf8; ALTER TABLE ozekimessagein ADD INDEX(id); CREATE TABLE ozekimessageout ( id int(11) NOT NULL auto_increment, sender varchar(255) default NULL, receiver varchar(255) default NULL, msg text default NULL, senttime varchar(100) default NULL, receivedtime varchar(100) default NULL, reference varchar(100) default NULL, status varchar(20) default NULL, msgtype varchar(160) default NULL, operator varchar(100) default NULL, errormsg varchar(250) default NULL, PRIMARY KEY (id)) charset=utf8; ALTER TABLE ozekimessageout ADD INDEX (id);Figure 4 - CREATE TABLE statements to copy
Now if you have the database created, you have to create two tables. One for inbox and one for outbox mails. Please copy the code you see on Figure 4. It will make all the necessary data fields. Highlight the code and press "CTRL + C" to copy it to your clipboard.
Now if you have the code on your clipboard, please paste it. If you have pasted it into the MySQL Command Line, press enter, and the application will build the tables for you. Feel free to modify the code to your liking, if you are familiar with the SQL language.
Now you need to do the last 2 steps you have done, but with the “ozekimessageout” table (Figure 5). You can copy it with “CTRL + C”, just as you did on Figure 3.
Now you just need to paste in the last copied code into the MySQL Command Line. Press "CTRL + V" to paste the code from your clipboard. If you have the code, please press Enter. now the Command Line will build your second table. Now you have all the required tables for Ozeki SMS Gateway. (Fiugre 6)
How to create a MySQL user
The following SQL commands (Figure 7) can be used to create a user called 'ozekiuser', with a password of 'ozekipass'. This is a MySQL user account. You can use this user account to connecto to the ozeki database, because the GRANT command has given access to this database.
CREATE USER 'ozekiuser'@'localhost' IDENTIFIED BY 'ozekipass'; GRANT ALL PRIVILEGES ON ozeki.* TO 'ozekiuser'@'localhost'; FLUSH PRIVILEGES;
More information
- MySQL basics
- Windows 11
- Send SMS from mySQL
- Database tables for storing SMS in mySQL
- Connect mySQL to the SMS gateway
- Send a test SMS from mySQL
- Encrypt MySQL database