Connection Database SQL with RStudio - mysql

I will start a new project ==> Data visualization by Rstudio. My data into a server phpMyAdmin (SQL Database).
I will use just 4 table. So in this case I should do a link between my database and Rstudio. I found this question on Stackoverflow enter link description here
I tried by this solution, I started by installed the package mySQL, but it return an error:
package ‘mysql’ is not available (for R version 3.2.2)
Knowing that I'm working on PalantirCloud.
Can you please give me a suggestion how can I resolve this problem?
Thank you.

1st grand ALL PRIVILEGES of remote MySQL server to a specific(database) user.
Then run these commands in Rstudio
install.packages("RMySQL")
library("RMySQL")
mydb = dbConnect(MySQL(),user='root',password='query',dbname='bd_test', host='192.X.X.X')
Where -
User = Remote MySQL database username
Password = Remote MySQL database user's password
dbname = Remote database name
And Host = The Remote server URL/IP address

Related

Visual Studio Code mssql extention: SQL Server (mssql) - Unable to connect to server

I'm trying for the first time to get my project to run in Visual Studio Code. This includes a MySQL database. So I've installed the SQL Server (mssql) extension version 1.7.1. I follow the instructions here: https://learn.microsoft.com/en-us/sql/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver15
I get to the section "Connect to SQL Server" and enter:
servername: localhost
db name: c3
Authentication type: Integrated
At the end of the section it should connect with the server but instead I get two errors:
mssql: Error "Unable to connect using the connection information
provided. Retry profile creation?"
mssql: Error 2: A network-related or instance-specific error occurred
while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a
connection to SQL Server)
Does anyone see what is going wrong here?
I've re-installed the extension but with the same result.
A MySQL db and Microsoft SQL Server db are two different things.
It seems that there's no SQL Server installed? You might install the free SQL Server Express Version, create the database in there and then connect from Visual Studio Code.
You have to install the database server yourself as VS Code is just a client. You might also use somekind of hosted offers (many webhosters offer a mysql server with self service installation, or use a cloud based database server). Yout can also use a local database (e.g. SqlLite) which is file based and doesn't need a special installation.
You should do the following
install SQL server in your machine and create Database here
Create a login and a database user here
If you are Using VS code install SQL Server (mssql) open new
connection, follow the prompts to specify the properties for the new
connection profile
If you want to login to your server to make sure of your data
sqlcmd -S localhost -U SA -P '<YourPassword>'

How to connect a mysql server to grafana?

I'm new on grafana and I need to connect my database (mysql) to it.
I tried to configure the custom.ini file as follow,
I added the next section on database
#################################### Database
####################################
type = mysql
host = localhost:3306
name = grafana (db on my sql server)
user = grafana (user on my sql server)
#### If the password contains # or ; you have to wrap it with triple quotes.
Ex “”"#password;"""
password =***** (password of my sql user)
and the next section on session
#################################### Session ####################################
[session]
provider = mysql (at the beginning)
provider_config = grafana:*******#tcp(localhost:3306)/grafana
provider = mysql (at the end)
When I try to connect to the serve I get this error : “Service init failed: Migration failed err: this authentication plugin is not supported”
I’m new on grafana and I don’t know if I have to set more thinks in the custom.ini
If someone can figure out what is wrong here I will be the happiest man on the world :D
Thanks for the time you spent reading this and a big big thanks to the savior !!
I finally find the problem. The fact is that mysql 8 has some permission faeture which brings a lot of issue for connecting to grafana or read files. So I install mysql 5.7 instead and all was fine !

How to know where my MySQL database is being hosted and how can I access it?

I have the following information to a SQL database
Server : MyUserName.mysql.db
User : MyUserName
Password : MyPassWord
I am a little noob in this context, so I have some questions:
How to know where is hosted my database? Is it in mysql domain? (Isn't that the type of database?)
How can I access it and visualize it?
To begin with, you need a CLIENT to be able to access your database. For MySQL, you can use either Workbench or MySQL CLIENT (the last giving you command-line level access).
Second, and according to your information, the server is MyUserName.mysql.db so if you try to PING that server you should get some response.
Third, MySQL has a default port number so you need to configure your client to access that server though that port (if I'm not mistaking, 3306).
You will also need access credentials to your database.
Your DB administrator should be able to provide all the information you need.
Contact your database administrator.
If you're trying to acess/visualize sql server database on your local computer install ssms to connect to your local database , similarly you can access any other database through ssms.

Cannot connect to MySQL Server database at localhost:3306

When I first set up MySQL Server in Netbeans everything worked well. Now one day I think I accidentally clicked something or my computer lost battery life when I was connected to MySQL Server, and after these event(s) I have not been able to connect to MySQL Server. I do not know for sure if either of the above events would have any effect on connecting to a MySQL Server database.
Anyway since these events I have found that I cannot "start" or "connect" to a MySQL Server databse. I am doing this all through Netbeans IDE.
Here is a picture of how I try to connect to my databaseL:
This is what the error message says after I click connect:
Unable to connect. Cannot establish a connection to jdbc:mysql://localhost:3306/twitterdata using com.mysql.jdbc.Driver(Unknown database 'twitterdata'). The name of the database I am trying to connect to is twitterdata
How can I get reconnected to the MySQL Server database "twitterdata"?
I am not familiar with MySQL, databases, servers and I have no idea how to get reconnected. If there is any other helpful information that I should provide let me know.
What MySQL tools can I run to find my problem?
Why would the error message tell me that the database is unknown?
If I got to C:\ProgramData\MySQL\MySQL Server 5.5\data. There is a folder named twitterdata.
Here are the contents of that directory:
Please let me know if you need more information or if you have other suggestions that would help!
Thanks for all the help!
If you are using windows system and facing the error 'unable to connect localhost 3306' at the connection time. First you have to need start MySQL services in 2 steps:
Press "Windows key + R" write "services.msc"
And run as admin start MySQL service.
There can be three issues:
1) Either your server isn't even running. Open your command prompt and enter mysql
2)Let's say it is , can you check if it's connecting on the correct port.
Like in the url, you are using 3306,
Try following this post:
How do I find out my MySQL URL, host, port and username?
3) Can you check what if there are any credentials to the database you are connecting?
https://netbeans.org/kb/docs/ide/install-and-configure-mysql-server.html

Unable to connect from local mysql server to AWS RDS db instance

I'm trying to import my .sql dump from local machine to AWS RDS db instance using the command:
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump --host=localhost
--user=root --password=admin e_learning_system | mysql
--host=mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com
--user=root --password=adminadmin e_learning_system
but it is throwing this error:
ERROR 2003 (HY000): Can't connect to MySQL server on
'mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com' (10060)
mysqldump: Got errno 22 on write
How do I correct this?
In case there is anyone who is still looking for a solution like I was, I managed to get it done by setting the security group in my RDS instance. Just go to that security group, you will find the click in "Security and Network" section. After you are on that security group page, edit the inbound rule, change the source to 0.0.0.0/0 (meaning accept from all) temporarily, and then import your db dump. That should work. But keep in mind you might want to revert it back this setting on production.
Yes, Amazon Beanstalk application and RDS security groups must be same for connecting application to database instance..
Right click on database instance and add a new security group using by beanstalk application..
error 2003 means no connection to mysql server. Check if you allowed the machine from where you connect to RDS in the RDS security group.
I prefer using MySQL workbench. It's much more easier & user friendly than the command line way.
It provides a simple GUI.
MySQL workbench or SQL Yog.
These are the steps that I did.
1) Install MySQL Workbench.
2) In AWS console, there must be a security group for your RDS instance. Add an inbound rule to that group for allowing connections from your machine. It's simple. Add your IP-address.
3) Open MySQL workbench, Add a new connection.
4) Give the connection a name you prefer.
5) Choose connection method- Standard TCP/IP
6) Enter your RDS endpoint in the field of Hostname (mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com).
7) Port:3306
8) Username: master username (the one which which you created during the creation of your RDS instance) (root)
9)Password: master password (admin admin)
10) Click Test Connection to check your connection.
11) If connection is successful, click OK.
12) Open the connection.
13) you will see your database 'e_learning_system' there.
14) Now you can export your mysqldump file to this database. Go to-> Server. Click Data Import.
15) You can check whether the data has been migrated by simply opening a blank SQL file & typing in basic SQL commands like use database, select * from table;
I was getting the same error and I solved it by adding mysql.exe... to the firewall of the machine I was connecting to.