
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@mastra/mysql
Advanced tools
Affected versions:
MySQL storage implementation for Mastra, providing persistent storage for threads, messages, workflows, traces, and more with connection pooling and transaction support.
npm install @mastra/mysql
import { MySQLStore } from '@mastra/mysql';
const store = new MySQLStore({
connectionString: 'mysql://user:password@localhost:3306/mastra',
});
// Create a thread
await store.saveThread({
thread: {
id: 'thread-123',
resourceId: 'resource-456',
title: 'My Thread',
metadata: { key: 'value' },
createdAt: new Date(),
updatedAt: new Date(),
},
});
// Add messages to thread
await store.saveMessages({
messages: [
{
id: 'msg-789',
threadId: 'thread-123',
role: 'user',
content: { content: 'Hello' },
resourceId: 'resource-456',
createdAt: new Date(),
},
],
});
// Query threads and messages
const savedThread = await store.getThreadById({ threadId: 'thread-123' });
const messages = await store.listMessages({ threadId: 'thread-123' });
import { Mastra } from '@mastra/core';
import { MySQLStore } from '@mastra/mysql';
export const mastra = new Mastra({
storage: new MySQLStore({
connectionString: 'mysql://user:password@localhost:3306/mastra',
}),
});
MySQLStore supports two connection methods:
1. Connection String
const store = new MySQLStore({
connectionString: 'mysql://user:password@localhost:3306/mastra',
});
2. Host/Port/Database
const store = new MySQLStore({
host: 'localhost',
port: 3306,
user: 'mastra',
password: 'mastra',
database: 'mastra',
});
ssl: Enable SSL or provide custom SSL options (true | false | object)max: Maximum pool connections (default: 10)database: Override the database name parsed from the connection stringwaitForConnections: Queue requests when the pool is full (default: true, host config only)queueLimit: Maximum queued connection requests, 0 for unlimited (default: 0, host config only)skipDefaultIndexes: Skip creating the built-in performance indexes during setup (default: false)indexes: Additional custom indexes to create during setupmysql2saveThread({ thread }): Create or update a threadgetThreadById({ threadId }): Get a thread by IDdeleteThread({ threadId }): Delete a thread and its messagessaveMessages({ messages }): Save multiple messages in a transactionlistMessages({ threadId, perPage?, page? }): Get messages for a thread with paginationdeleteMessages(messageIds): Delete specific messagesThe test suite reads the following variables to connect to MySQL, falling back to the defaults shown:
MYSQL_HOST (default: localhost)MYSQL_PORT (default: 3306)MYSQL_USER (default: mastra)MYSQL_PASSWORD (default: mastra)MYSQL_DB (default: mastra)Unit tests run without a database:
pnpm test src/storage/index.unit.test.ts
Integration tests use Docker to start a MySQL instance, run the suite, and clean up afterward:
# Ensure Docker is running
pnpm test
FAQs
MySQL provider for Mastra - db storage capabilities
We found that @mastra/mysql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.