I want to connect mysql DB and insert some values into the table. But I get the result: "INSERT command denied to user '' #'localhost' for table 'paramenttable'".
DB connection page
(to call the two function in route.js like this:)
mysqlinsertp.conn();
mysqlinsertp.insert(array_1);
the error page:
The config for mysql could not be found in that variable. The module exports of settings.js provide a mysql item. You should use that instead of the root.
Your client initialization should be following:
var client = mysql.createConnection(settings.mysql);
instead of mysql.createConnection(settings);
Related
I'm trying to create a simple dag that dumps mysql to a bucket like this:
extract = MySqlToGoogleCloudStorageOperator(
task_id='extract_data',
mysql_conn_id='mysql_instance_connection',
google_cloud_storage_conn_id='google_cloud_storage_default',
sql='SELECT * FROM guestbook.entries',
bucket='gs://bucketname',
filename='guestbook.dump',
dag=dag)
I create a MySQL connection called mysql_instance_connection with the ip address for the host, database name for the schema, login and password that I setup when creating the database online, and port as 3306.
When I run the dag I get the following error:
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '[IP_ADDRESS]' (110)")#-#{"task-id": "extract_data", "execution-date": "2018-08-21T16:35:59.161183", "workflow": "extractMysqlData"}
What do I need to do to give composer permission to access my MySQL database?
I use remote login to connect to the database (residing on AWS). I'd like to truncate one of my tables. But this command does not seem to work on bash:
mysql --login-path=remote --database=marketing 'truncate table my_test_table'
I get the message
ERROR 1044 (42000): Access denied for user 'mdb_updater'#'%' to
database 'truncate table pedram_test_table'
mdb_updater is my username on the database.
This is when I can successfully run mysqlimport and mysqldump using the same credentials.
MySQL cli treats positional argument as database name, pass statement you want to run with --execute option:
mysql --login-path=remote --database=marketing --execute 'truncate table my_test_table'
Here is my sample code for using DBI:
db = DBI.connect("DBI:Mysql:database=testdatabase;host=testhost;port=30012", "testuser", "testpassword")
It returned, and looks no problem:
#<DBI::DatabaseHandle:0x00000001c7f0f0 #handle=#<DBI::DBD::Mysql::Database:0x00000001c9f148 #handle=#<Mysql:0x00000001ca6678>, #attr={"AutoCommit"=>true}, #have_transactions=true, #mutex=#<Mutex:0x00000001c813f0>>, #trace_output=nil, #trace_mode=nil, #convert_types=true, #driver_name="Mysql">
And then I call the "prepare" method:
sql = "select * from users where id in (?)"
dbh = db.prepare(sql)
And it also looks ok(The follow code is just a part of the return):
#<DBI::StatementHandle:0x00000005e404a8 #handle=#<DBI::DBD::Mysql::Statement:0x00000005e42118 #attr={}, #mutex=#<Mutex:0x00000001c813f0>, #handle=#<Mysql:0x00000001ca6678>, #parent=#<DBI::DBD::Mysql::Database:0x00000001c9f148 #handle=#<Mysql:0x00000001ca6678>, #attr={"AutoCommit"=>true}, #have_transactions=true, #mutex=#<Mutex:0x00000001c813f0>>
But when I use "execute" method:
dbh.execute('1,2,3')
Then it occur error:
DBI::DatabaseError: Access denied for user 'testuser'#'120.120.120.120' (using password: YES)
I'm sorry, I mistook the direction of the question, Actually, The cause of the problem is the "into outfile" method privileges. It need Mysql open "file" privileges. Like this:
grant file on *.* to 'username'#'hostname';
I'm trying to import an SQL file I have on a server and put it into the database. But I keep failing and it gives me an error.
This is the command and error I get:
try logging into mysql first
mysql -p username
enter your password:
mysql> source yourfile.sql;
i would like to import csv file in mysql database.
my query would be like the following.
query = "LOAD DATA INFILE '"+filename+"' INTO TABLE testtable FIELDS TERMINATED BY ',' (text,price)";
But i got the following error while importing file.
java.sql.SQLException: Access denied for user 'root'#'%' (using password: YES)
for full source code you can see http://www.javalobby.org/java/forums/t53674.html.
Any Help is greatly appriciated.
Thanks.
the user you are using does not have the privileges to load data
you might also need to specify LOAD DATA LOCAL
make use user root allowed to access other than from localhost
as error shows, you should double check if user-password-host-db combination is correct. this is what the error tells you.
Make sure you are allowed to log into the database as root and you have the correct password in your connect string (caspian)
Connection conn = db.connect("jdbc:mysql://localhost:3306/test","root","caspian");