# Codex MySQL Dependency Not Working

**URL:** <https://community.openai.com/t/codex-mysql-dependency-not-working/1266857>\
**Category:** Codex\
**Tags:** codex\
**Created:** [May 20, 2025, 3:02pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857 "2025-05-20T15:02:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattejames](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattejames/32/129394_2.png) [@mattejames](https://community.openai.com/u/mattejames)\
**Post date:** [May 20, 2025, 3:02pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/1 "2025-05-20T15:02:54Z")

</div>

I need to install a MySQL server as a dependency.

Whenever I use:

```auto
sudo apt-get update
sudo apt-get install -y mysql-server
sudo service mysql start

```

It starts it and tells me the pid, but then just hangs there. Any suggestions?

---

<div class="post-metadata">

**Author:** ![knavillus](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/knavillus/32/632761_2.png) [@knavillus](https://community.openai.com/u/knavillus)\
**Post date:** [May 20, 2025, 4:55pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/2 "2025-05-20T16:55:25Z")

</div>

I just banged on this for 20 minutes and get the same result, it hangs on ‘mysqld is running as pid 4621’ and eventually leads to timeout. My gut feeling is this use case might need to wait for custom container rollout.

---

<div class="post-metadata">

**Author:** ![swombat](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@swombat](https://community.openai.com/u/swombat)\
**Post date:** [May 21, 2025, 6:10am UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/3 "2025-05-21T06:10:41Z")

</div>

Fwiw I have pgsql running just fine with the following setup script:

```auto
#!/usr/bin/env bash
set -euo pipefail
apt-get update -qq
apt-get install -yqq postgresql

pg_ctlcluster --skip-systemctl-redirect 16 main start
su - postgres -c "createuser -s $(whoami)"

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![mattejames](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattejames/32/129394_2.png) [@mattejames](https://community.openai.com/u/mattejames)\
**Post date:** [May 21, 2025, 2:17pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/4 "2025-05-21T14:17:24Z")

</div>

Interesting, thanks @swombat!

Prior to getting it to work, did you have a similar issue to what @knavillus and I describe when we try to get MySQL working? Ie, was it hanging on the pid? Or did it just work on your first try?

---

<div class="post-metadata">

**Author:** ![knavillus](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/knavillus/32/632761_2.png) [@knavillus](https://community.openai.com/u/knavillus)\
**Post date:** [May 21, 2025, 6:18pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/5 "2025-05-21T18:18:33Z")

</div>

Mine hung up on the pid, I was trying to do what @swombat did, but didn’t have the chops :). Nice work. Here is my test of this on the environment setup, works great!

 ![Screenshot 2025-05-21 at 12.15.58 PM](https://us1.discourse-cdn.com/openai1/original/4X/f/2/1/f218d5d232cb790bb3d86951afdd21a1746cf3bd.png)

And when I fired off this task:

> This repo is empty, and you don’t need to add any code. For this task we are testing the postgres implementation. Please use:  
> createdb -U (whoami) (whoami)  
> psql -U $(whoami)
> 
> and the create a table:  
> CREATE TABLE test\_table(id SERIAL PRIMARY KEY, name TEXT);  
> INSERT INTO test\_table(name) VALUES (‘hello’);  
> SELECT \* FROM test\_table;
> 
> Report back with results to see if you can interact with the DB

 ![Screenshot 2025-05-21 at 12.16.53 PM](https://us1.discourse-cdn.com/openai1/original/4X/9/2/8/928fdbae2cd9129b8ea11a4e9b6284379eb7edfb.png)

---

<div class="post-metadata">

**Author:** ![mattejames](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattejames/32/129394_2.png) [@mattejames](https://community.openai.com/u/mattejames)\
**Post date:** [May 21, 2025, 7:23pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/6 "2025-05-21T19:23:02Z")

</div>

Very cool!

Shame my app is pretty dependent on MySQL and that I can’t use Postgres ☹

---

<div class="post-metadata">

**Author:** ![knavillus](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/knavillus/32/632761_2.png) [@knavillus](https://community.openai.com/u/knavillus)\
**Post date:** [May 21, 2025, 8:15pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/7 "2025-05-21T20:15:52Z")

</div>

OK, hacked at it some more (thankyou o3 for the assist). Let me know if this gets you rolling…  
[Codex Task](https://chatgpt.com/s/cd_682e340e44c48191b075fc3e332ca86d)

```auto
#!/usr/bin/env bash
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive

# 1. Install the minimal binaries
apt-get update -qq
apt-get install -yqq --no-install-recommends \
        mysql-server-core-8.0 mysql-client-core-8.0 passwd

# 2. Ensure the mysql system account exists
if ! id -u mysql >/dev/null 2>&1; then
  groupadd --system mysql
  useradd --system --gid mysql --home /nonexistent \
           --shell /usr/sbin/nologin mysql
fi

# 3. Data directories **and** secure-file-priv directory
mkdir -p /var/lib/mysql \
         /var/lib/mysql-files \
         /var/run/mysqld
chown -R mysql:mysql /var/lib/mysql /var/lib/mysql-files /var/run/mysqld
chmod 750 /var/lib/mysql-files # MySQL expects owner-only access:contentReference[oaicite:1]{index=1}

# 4. Initialise and start detached
mysqld --initialize-insecure --user=mysql # empty root pwd:contentReference[oaicite:2]{index=2}
mysqld --daemonize --user=mysql \
       --socket=/var/run/mysqld/mysqld.sock \
       --pid-file=/var/run/mysqld/mysqld.pid

# 5. Wait until the server is ready
until mysqladmin --socket=/var/run/mysqld/mysqld.sock ping --silent; do sleep 1; done
#verify
# Should print exactly one mysqld line
ps -fp $(cat /var/run/mysqld/mysqld.pid)
# Fast “is it alive?” check
mysqladmin --socket=/var/run/mysqld/mysqld.sock ping
# → mysqld is alive

# A few server counters & compile flags
mysqladmin --socket=/var/run/mysqld/mysqld.sock version

```

 ![Screenshot 2025-05-21 at 2.15.28 PM](https://us1.discourse-cdn.com/openai1/original/4X/7/f/9/7f9ca8283037ef078cc892747f5f6b4b2e89f176.png)

---

<div class="post-metadata">

**Author:** ![mattejames](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattejames/32/129394_2.png) [@mattejames](https://community.openai.com/u/mattejames)\
**Post date:** [May 22, 2025, 4:46pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/8 "2025-05-22T16:46:00Z")

</div>

Wow, that totally worked – THANK YOU!

---

<div class="post-metadata">

**Author:** ![swombat](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@swombat](https://community.openai.com/u/swombat)\
**Post date:** [May 23, 2025, 12:53pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/9 "2025-05-23T12:53:57Z")

</div>

I did not have those issues. I asked ChatGPT (!) what to install to get postgres working, it suggested these packages and commands, I thought, yeah ok that makes sense, I tried, it worked.

---

<div class="post-metadata">

**Author:** ![mattejames](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattejames/32/129394_2.png) [@mattejames](https://community.openai.com/u/mattejames)\
**Post date:** [May 23, 2025, 7:19pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/10 "2025-05-23T19:19:21Z")

</div>

In case it helps someone else in the future, MariaDB seems to install right off the bat without any extra stuff. So if your app is compatible or depends on that, it’s pretty straight forward.

```auto
# Install MariaDB
sudo apt-get install -y mariadb-server

# Start MariaDB using service instead of systemd
sudo service mariadb start

# Check MariaDB version
mariadb --version

```

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [May 23, 2025, 7:29pm UTC](https://community.openai.com/t/codex-mysql-dependency-not-working/1266857/11 "2025-05-23T19:29:34Z")

</div>

> [@mattejames](#):
>
> In case it helps someone else in the future

Thanks so much! You’re the type of user we want to see more around here! 😉

I’d welcome you to the community, but it seems [you’ve been around](https://community.openai.com/t/how-to-tell-gpt-to-retrieve-files-for-different-purpose/492358/6) a while now!

Seriously, though, thanks for helping out. It’s appreciated.

I don’t know how many times a Google search for an arcane problem has saved me in the past, so hopefully this helps someone in the future.
