Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Last active May 23, 2022 06:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/3a71b7150275cff5625090724d48daf3 to your computer and use it in GitHub Desktop.
Save vpnwall-services/3a71b7150275cff5625090724d48daf3 to your computer and use it in GitHub Desktop.
[MYSQL TO JSON] Mysql data to json #mysql #to #json
select JSON_OBJECT
('id', id,
'user_login', user_login,
'user_pass', user_pass,
'user_nicename', user_nicename,
'user_email', user_email,
'user_url', user_url,
'user_registered', user_registered,
'user_activation_key', user_activation_key,
'user_status', user_status,
'display_name', display_name)
from wp_users INTO OUTFILE '/root/wp_users.json';
GRANT FILE ON *.* TO 'user'@'localhost';
@dubeyji10
Copy link

dubeyji10 commented May 23, 2022

thank you so much
i feel so stupid now for complicating things
i was using group_concat on top of concating { + key + value }
this is so good and fast
edit - although it did not give a 100% result it skipped comma after every collection
( still thanks )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment