Replace MySQL with MemCP: Difference between revisions
Jump to navigation
Jump to search
(Created page with "thumb === Connection to MemCP === MemCP can be connected with any compatible MySQL connector: $db = new \PDO<code>"mysql:host=localhost;port=3307;dbname=system", 'root', 'admin');</code>") |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[File: |
+ | [[File:Ports.svg|thumb|none|640x640px]] |
− | |||
=== Connection to MemCP === |
=== Connection to MemCP === |
||
MemCP can be connected with any compatible MySQL connector: |
MemCP can be connected with any compatible MySQL connector: |
||
$db = new \PDO<code>"mysql:host=localhost;port=3307;dbname=system", 'root', 'admin');</code> |
$db = new \PDO<code>"mysql:host=localhost;port=3307;dbname=system", 'root', 'admin');</code> |
||
+ | echo $db->query("SELECT 'it works'")->fetchColumn(); |
||
+ | |||
+ | // outouts: it works |
||
+ | |||
+ | === Import data from MySQL === |
||
+ | To import data from MySQL into MemCP, you have to perform two steps: |
||
+ | |||
+ | # <code>sudo apt install python3-mysql.connector</code> |
||
+ | # in <code>memcp</code>: <code>./mysqldump-to-json.py -h localhost -u USER -p PASSWORD database > dump.jsonl</code> |
||
+ | # in memp's scheme console: (loadJSON "database" "dump.jsonl") |
Latest revision as of 11:17, 31 October 2024
Connection to MemCP
MemCP can be connected with any compatible MySQL connector:
$db = new \PDO"mysql:host=localhost;port=3307;dbname=system", 'root', 'admin');
echo $db->query("SELECT 'it works'")->fetchColumn();
// outouts: it works
Import data from MySQL
To import data from MySQL into MemCP, you have to perform two steps:
sudo apt install python3-mysql.connector
- in
memcp
:./mysqldump-to-json.py -h localhost -u USER -p PASSWORD database > dump.jsonl
- in memp's scheme console: (loadJSON "database" "dump.jsonl")