RJ博客

MySQL连接优化

本文目录

在使用MySQL时,可能会遇到程序连接本地MySQL数据库速度很慢,这很有可能是使用了localhost作为连接时的主机名。注意啦,是数据库就在本地哦,如果是远程连接MySQL慢可能是网络原因。


解决方法:


方法一:ping一下localhost,如果ping出来是::1,那就是解析到了IPV6的ip了,把hosts文件中增加127.0.0.1 localhost,将localhost解析为127.0.0.1。如果有::1 localhost那就去掉。


方法二:在MySQL配置文件中的[mysqld]下增加skip-name-resolve,然后重新启动MySQL服务即可。此方法使用后,连接MySQL时的主机名就不能用域名和localhost了,只可以用ip地址。


如果以上方法还是很慢,建议重新配置运行环境或重新安装系统。


相关推荐

发表评论

  • 欢迎评论

  • We at BestLocalData.com has been hit badly by Covid-19 and as a result BestLocalData.com is shutting down. We provided the best data to companies to find their right customer base, we don't want other companies to go down the same path we went and go out of business. As a result we are providing our data till the end of the week at the lowest possible prices. BestLocalData.com

  • Hello, It is with sad regret to inform you that BestLocalData.com is shutting down. We have made all our databases for sale for a once-off price. Visit our website to get the best bargain of your life. BestLocalData.com Regards, Garfield

  • Hello from SendBulkMails.com, We have a special limited offer for you to send unlimited emails. We allow non-permission based emails and you won't ever get blocked. We also buy your domain for you and give you a clean IP and setup your DNS records. Check us out on SendBulkMails.com

  • Hello, BestLocalData.com has a special package you get any group of databases for $49 or $249 for all 16 databases and unlimited emails for a year(Domain, IP, Dashboard included). You can purchase it on BestLocalData.com and see samples if you are interested.

  • Do you need more clients? We have amazing databases starting at $9.99 until the end of the Month! Visit us at StarDataGroup.com

  • Use SendBulkMails.com to run email campaigns from your own private dashboard. Cold emails are allowed and won't get you blocked :) - 1Mil emails / mo @ $99 USD - Dedicated IP and Domain Included - Detailed statistical reports (delivery, bounce, clicks etc.) - Quick and easy setup with extended support at no extra cost. - Cancel anytime! Regards, www.SendBulkMails.com

  • It is with sad regret to inform you StarDataGroup.com is shutting down. Fire sale going on! Any group of databases listed below is $49 or $149 for all 16 databases in this one time offer. You can purchase it at www.StarDataGroup.com and view samples. - LinkedIn Database 43,535,433 LinkedIn Records - USA B2B Companies Database 28,147,835 Companies - Forex Forex South Africa 113,550 Forex Traders Forex Australia 135,696 Forex Traders Forex UK 779,674 Forex Traders - UK Companies Database 521,303 Companies - German Databases German Companies Database: 2,209,191 Companies German Executives Database: 985,048 Executives - Australian Companies Database 1,806,596 Companies - UAE Companies Database 950,652 Companies - Affiliate Marketers Database 494,909 records - South African Databases B2B Companies Database: 1,462,227 Companies Directors Database: 758,834 Directors Healthcare Database: 376,599 Medical Professionals Wholesalers D

  • It is with sad regret to inform you StarDataGroup.com is shutting down. Fire sale till the 7th of Feb. Any group of databases listed below is $49 or $149 for all 16 databases in this one time offer. You can purchase it at www.StarDataGroup.com and view samples. - LinkedIn Database 43,535,433 LinkedIn Records - USA B2B Companies Database 28,147,835 Companies - Forex Forex South Africa 113,550 Forex Traders Forex Australia 135,696 Forex Traders Forex UK 779,674 Forex Traders - UK Companies Database 521,303 Companies - German Databases German Companies Database: 2,209,191 Companies German Executives Database: 985,048 Executives - Australian Companies Database 1,806,596 Companies - UAE Companies Database 950,652 Companies - Affiliate Marketers Database 494,909 records - South African Databases B2B Companies Database: 1,462,227 Companies Directors Database: 758,834 Directors Healthcare Database: 376,599 Medical Professionals Wh

  • 好屌