I am attempting to import my ClearDB database in Heroku by running the command in the window:
mysql -u REDACTED -h us-cdbr-iron-east-02.cleardb.net -p REDACTED < C:/Users/KJA/Downloads/androidchatterdatabase.sql
After inputting the password, the error appears as:
ERROR 1227 (42000) at line 27: Access Denied; you need (at least one of) the SUPER privilege(s) for this operation
Then when seeing what the login is that would require the privileges it notes as:
Is there an alternative host address to use? How can I send my database schema to ClearDB in Heroku and run?
You need to select a database to work on by passing that as an argument to the command; you don't have privileges for any operation without a database (because that would let you control things at the "server level", not the database level).
Your command needs to be mysql -u YOURUSERNAME -h us-cdbr-iron-east-02.cleardb.net -p YOURPASSWORD heroku_XXXX < C:/Users/KJA/Downloads/androidchatterdatabase.sql (or whatever your database name is; I took "heroku_XXXX" from one of your other questions).
Related
I have an install script that can create a db, with
(sql ddl)create database if not exist.
Since Postgres works differently the script doesn't work.
So I build a special case for Postgres and used the
(commandline) createdb -U ... command for generating a database.
It works so far, but Postgres requests the password a second time.
Following this thread i found out that
I can provide the password with the var PGPASSWORD
Following this thread i came up with a solution:
(php)
exec(' set PGPASSWORD=$password && createdb -U "$username" -h "$host" "$dbname" ')
(simplified escapes)
but this returns an error:
createdb: could not connect with template1: FATAL: Password authentication for user »postgres« failed (translated)
I am not familiar with commandline and its characteristics ->
I am not sure if I did a grave unnoticed misstake there, i am sorry if i did
I will implement now a version where Postgres asks the user a second time,
but it would be cool if you find a solution where the user doesn't have to type password twice
Why use an operating system command? You can do the same thing with SQL: Simply connect to the postgres database (or any other database) and run
CREATE DATABASE dbname
I am importing a MySQL database from another server to my own server using phpMyAdmin. But the problem is:
I go into import then choose a file which have extension like .sql, .xml. After this procedure I click on the ok button but this doesn't give any response and doesn't even do anything, the page just remains stable.
I also tried with MySQL command prompt using mysqldump.
mysqldump -u username -p databse > database name
but this is also giving an error.
Can any one please help me in solving this?
This command is used to export :
mysqldump -h hostname -u username -p database > sql_file_name
to import you should use
mysql -h hostname -u username -p database < full_file_path
first you need to export a DB from the first server.
on your server you first need to create a new DB and than do the import.
the DB you imported will go to the DB you just created.
Recently, I've started using openshift & also deployed an application using PHP & MySQL. Yesterday, out of curiosity, I've removed the password for phpMyAdmin and guess what, now I'm unable to log in to both phpMyAdmin & mysql database.
I've tried both the passwords (the default one & the empty password) and uninstalled & re-installed the PHPmyAdmin catridge & also, force restarted the app several times but nothing worked. Now, I've no idea what happened. Any help is appreciated.
Hopefully this will help.
I assume what you did was go into phpmyadmin and click on 'users' then 'edit privileges' for one of the users, select 'no password' and hit save right? If so, then I think the following steps should help.
1.) ssh into your gear (you can use the rhc ssh command)
2.) run the mysql command
3.) You should get an error like this ERROR 1045 (28000): Access denied for user 'adminslULJTS'#'127.10.126.130' (using password: YES)
4.) Now, type in the command mysql -u $OPENSHIFT_MYSQL_DB_USERNAME -h $OPENSHIFT_MYSQL_DB_HOST -P $OPENSHIFT_MYSQL_DB_PORT -p
5.) When it asks for a password, just hit enter
6.) You should now be logged into the mysql shell
Now you need to reset your password to what openshift thinks it is.
1.) create another ssh session into your gear in another terminal, leaving the old one open
2.) run the command env | grep MYSQL
3.) this will give you the following information that you will need to reset your password:
OPENSHIFT_MYSQL_DB_HOST=127.10.126.130
OPENSHIFT_MYSQL_DB_PASSWORD=Il8-rVLIKSrx
OPENSHIFT_MYSQL_DB_USERNAME=adminslULJTS
Given the above information, go back to your ssh session that had the mysql connection open, and enter the following command:
set password for 'adminslULJTS'#'127.10.126.130' = PASSWORD('Il8-rVLIKSrx');
But you will need to replace the username, host, and password with the ones you got from the above step.
You should now be able to log into phpmyadmin with your old username & password that you can either view using the env | grep MSYQL command, or view in the web console for your application at openshift.com
It also might be worth reviewing this KB article: https://www.openshift.com/kb/kb-e1085-possible-complications-when-changing-your-database-credentials
When I try to connect to the local MySQL database I am getting different results from these three methods:
It works when I connect with the following from the prompt:
mysql -u root -p
This way prompts me for the password, and once typed I am connected.
It works when I connect with PHP and supply the server(localhost), username(root), and password.
It does not work when I connect with PHP to run a command like this:
exec('mysql -P 3306 -u root -p'.$password.' databasename < '.$scriptfilename);
I also cannot get it to work from the prompt when I supply the password in the first line.
When I query the mysql.user table for the user root there are 3 entries:
root#::
root#127.0.0.1
root#localhost
There error I get when supplying the password in the same line is:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Anybody know whats going on?
If your password contains special characters that the shell will interpret, you'll have problems unless you escape them. For example lots of punctuation will cause issues, such as !, >, <, | and more.
Generally though, do not put the password on the command-line if you can possibly help it!
To quote MySQL's 5.3.2.2. End-User Guidelines for Password Security document:
Use a -pyour_pass or --password=your_pass option on the command line.
This is convenient but insecure, because your password becomes visible to system status programs such as ps that may be invoked by other users to display command lines.
The other option is to store the password in a file that only the relevent users can read, and use the client config file:
Store your password in an option file.
[client]
password=your_pass
Then the command-line would be:
mysql --defaults-file=/path/to/file_with_password
Just add the host parameter like this:
exec('mysql -P 3306 -h localhost -u root -p'.$password.' databasename < '.$scriptfilename);
You could try using --password= rather than -p, I have found it more reliable
When I try to connect to my backoffice in my website I get this error :
SQLSTATE[28000][1045]Access denied for user 'root'#'localhost'(using password:NO))
Can someone help me fix this?
You must use a password. Try to set one with "mysqladmin -u root password NEWPASSWORD"
You need to supply a password when logging into your database. When you connect to sql from php, make sure you're supplying this password.
If you set a root password previously, but have forgotten it, you can set a new password. I am working on a Windows machine, and was able to reset the password on the root of MySql using the directions http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html. I created a text file (mysql-init.txt) as follows:
UPDATE mysql.user SET Password=PASSWORD('[choose your password')
WHERE User='root';
FLUSH PRIVILEGES;
At the command line, I entered the following (either make sure you are in the mysql\bin directory or that your path environment variable includes a path to that directory), which will start the server:
mysqld --init-file=C:\\mysql-init.txt --console
This printed out a bunch of status statements. To stop the server, I typed this in another command line:
mysqladmin –u root –p[choose your password] shutdown
Of course, replace the [choose your password] with the same password you used in the mysql-init.txt file. In the first command line, you should get more status statements that indicate that the server is shutting down.
Now that you have a password for your root user, you can go back to the connection statement you are using to connect to the database and add the password and user.