求助:XAMPP v3.2.1中MySQL错误提示无法切换为葡萄牙语
Hey there, let's figure out why your Portuguese error messages aren't showing up even after adding lc-messages = pt_BR to your my.ini. I've dealt with this exact quirk in older XAMPP versions, so here's a step-by-step breakdown to get it working:
1. Check if the Portuguese language pack exists in your XAMPP setup
XAMPP's default MySQL installation usually only includes the English language pack out of the box. Head to your XAMPP MySQL share directory—typically xampp/mysql/share/—and look for a folder named pt_BR. If it's missing, that's the root issue: MySQL can't load translations that aren't present.
To fix this, grab the pt_BR language folder matching your MySQL version (XAMPP v3.2.1 uses MySQL 5.6.x) and copy it into xampp/mysql/share/.
2. Update your my.ini configuration correctly
Just setting lc-messages = pt_BR isn't always enough. You need to specify where MySQL can find the language packs. Open the my.ini file located in xampp/mysql/bin/ (make sure you're not editing a sample config elsewhere) and add these lines:
lc-messages-dir = "C:/xampp/mysql/share" # Adjust this path to match your actual XAMPP installation location lc-messages = pt_BR
Double-check the file path is accurate—if your XAMPP is installed on a different drive or folder, update it accordingly.
3. Restart MySQL properly
After editing the config, use the XAMPP Control Panel to fully stop and restart the MySQL service. Wait a few seconds between stopping and starting to ensure the new configuration loads completely.
4. Verify the configuration is active
Once MySQL is back up, log into the MySQL command line (use the "Shell" button in the XAMPP Control Panel) and run this query:
SHOW VARIABLES LIKE 'lc_messages%';
You should see lc_messages set to pt_BR and lc_messages_dir pointing to your xampp/mysql/share/ directory. If not, double-check your my.ini edits and confirm you're modifying the correct file.
5. Test with a deliberate error
To confirm it's working, run a query that will trigger an error—like SELECT * FROM non_existent_table;. If everything is set up correctly, the error message should now display in Portuguese.
If you still hit snags, make sure the pt_BR folder has proper read permissions (especially on Windows) and that the language pack version matches your MySQL version.
内容的提问来源于stack exchange,提问作者M.Souza

