# How create table in mySQL?

**URL:** <https://forums.solar2d.com/t/how-create-table-in-mysql/349247>\
**Category:** Coronium\
**Created:** [January 11, 2019, 9:03pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247 "2019-01-11T21:03:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anaqim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@anaqim](https://forums.solar2d.com/u/anaqim)\
**Post date:** [January 11, 2019, 9:03pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/1 "2019-01-11T21:03:46Z")

</div>

hi,

so i suddenly find myself in need of being able to create new server side mysql tables in code, similar to how its done locally in sqlite3.

when user register in my app, a separate user table needs to be created.

does anyone know of a way to do that in coronium?

---

<div class="post-metadata">

**Author:** ![Benzeliden](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@Benzeliden](https://forums.solar2d.com/u/Benzeliden)\
**Post date:** [January 14, 2019, 7:13pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/2 "2019-01-14T19:13:08Z")

</div>

Hello

Having 1 table per user sounds strange, but if you really wish to do this:

1. create separate database on server

2. use&nbsp;core.mysql.query( db\_name, query\_str ), specify database and write your script ("Create table something … ")

---

<div class="post-metadata">

**Author:** ![anaqim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@anaqim](https://forums.solar2d.com/u/anaqim)\
**Post date:** [January 14, 2019, 7:29pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/3 "2019-01-14T19:29:20Z")

</div>

Hi,

Thank you for your reply.

Now that i see it I should have realized 🙂

A table per user has advantages and there is no limit to the number of tables mySQL supports.

It can help improve security by not making other users tables exposed to a malicious user.

I’d save some space by not needing a user id column (a CHAR 36 type)

I suspect performance may improve a little too, and certainly not be worse.

One possible downside is i suspect RAM need will increase a little, but need to test that one to be sure.

Thanks again!

---

<div class="post-metadata">

**Author:** ![anaqim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@anaqim](https://forums.solar2d.com/u/anaqim)\
**Post date:** [January 14, 2019, 7:37pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/4 "2019-01-14T19:37:22Z")

</div>

I’ll also be looking into mysql table partitioning as an alternative, so nothing is set in stone yet.

---

<div class="post-metadata">

**Author:** ![Develephant](https://forums.solar2d.com/user_avatar/forums.solar2d.com/develephant/32/2729_2.png) [@Develephant](https://forums.solar2d.com/u/Develephant)\
**Post date:** [February 20, 2019, 4:02pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/5 "2019-02-20T16:02:07Z")

</div>

Hi,

Late reply, but I would look into table joins, etc. as an alternative to separate tables per user. Each table will consume more memory, where as an ID data field will take a negligible amount.

If your user base becomes very large you will be facing an issue in my opinion.

-dev

---

<div class="post-metadata">

**Author:** ![Benzeliden](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@Benzeliden](https://forums.solar2d.com/u/Benzeliden)\
**Post date:** [January 14, 2019, 7:13pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/6 "2019-01-14T19:13:08Z")

</div>

Hello

Having 1 table per user sounds strange, but if you really wish to do this:

1. create separate database on server

2. use&nbsp;core.mysql.query( db\_name, query\_str ), specify database and write your script ("Create table something … ")

---

<div class="post-metadata">

**Author:** ![anaqim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@anaqim](https://forums.solar2d.com/u/anaqim)\
**Post date:** [January 14, 2019, 7:29pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/7 "2019-01-14T19:29:20Z")

</div>

Hi,

Thank you for your reply.

Now that i see it I should have realized 🙂

A table per user has advantages and there is no limit to the number of tables mySQL supports.

It can help improve security by not making other users tables exposed to a malicious user.

I’d save some space by not needing a user id column (a CHAR 36 type)

I suspect performance may improve a little too, and certainly not be worse.

One possible downside is i suspect RAM need will increase a little, but need to test that one to be sure.

Thanks again!

---

<div class="post-metadata">

**Author:** ![anaqim](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@anaqim](https://forums.solar2d.com/u/anaqim)\
**Post date:** [January 14, 2019, 7:37pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/8 "2019-01-14T19:37:22Z")

</div>

I’ll also be looking into mysql table partitioning as an alternative, so nothing is set in stone yet.

---

<div class="post-metadata">

**Author:** ![Develephant](https://forums.solar2d.com/user_avatar/forums.solar2d.com/develephant/32/2729_2.png) [@Develephant](https://forums.solar2d.com/u/Develephant)\
**Post date:** [February 20, 2019, 4:02pm UTC](https://forums.solar2d.com/t/how-create-table-in-mysql/349247/9 "2019-02-20T16:02:07Z")

</div>

Hi,

Late reply, but I would look into table joins, etc. as an alternative to separate tables per user. Each table will consume more memory, where as an ID data field will take a negligible amount.

If your user base becomes very large you will be facing an issue in my opinion.

-dev
