Can't connect to local MySQL server in R -


i learning how use mysql in r package rmysql:

https://www.tutorialspoint.com/r/r_database.htm

but when try connect db provided in example

mysqlconnection = dbconnect(mysql(), user = 'root', password = '', dbname = 'sakila', host = 'localhost') 

i get:

 failed connect database: error: can't connect local mysql server through socket '/tmp/mysql.sock' (2) 

my guess running on laptop (mac os), if guess right (?) need virtual server.

do know r package so? suggestion appreciated.

first check sql service running.

service mysqld start

then try mysql -u root

if not solve issue above solution try host = '127.0.0.1' instead of localhost. because 127.0.0.1 use tcp/ip connector. unless localhost run socket connector.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -