importing database from phpmyadmin to linode - mysql

I've been searching the web for a solution for a while now & just can't seem to get it with what i've found online. I've exported my phpMyAdmin database & uploaded it to my Linode so its now there ( /home/user_name/public/www.sitename.com/public/phpmyadmindatabase.sql )
So now in the terminal i'm entering the following:
mysql -u root -pMyPassword database_name < ~/public/sitename.com/public/phpmyadmindatabase.sql
and I get the following:
ERROR 1049 (42000): Unknown database 'database_name'
Now I'm wondering if i need to create 'database_name' first, but I'm following Linode's own start up guides:
http://library.linode.com/hosting-website#sph_installing-mysql
and they say right at the section "Creating a Database"...(If you already have a database you'd like to import...skip to "importing a database"). So i have been assuming i shouldn't be creating a database since it told me to skip it.
Any & all help would be greatly appreciated...
thanks,

Stupid mistake...just needed to create the new DB manually or make sure phpmyadmin is creating the DB in mysql when its added to the Linode.
On another note - Linode has pretty great customer support (guess that would be the first place to go).

Related

Download MySQL database from ISP server to localhost

Non-coder here, please advise as newbie. I have a MySQL DB on my ISP's server that provides data for a web site. I want to set up a db on my localhost that I can use for local development. The DBs don't need to be linked, nor do they need to remain synchronized. I just need to start with a current copy of the ISP version.
I have used PHPMyAdmin on ISP to download what I think is a dump file. the file, [mydbname].sql shows the schema and all the data. I just can't figure out how to import it in MySQL Workbench on my local PC.
Using the MySQL Workbench Data Import tab, if I execute "Import from Dump Project Folder" where the .sql file is located, I get "There were no dump files in the selected folder."
If I select "Import from Self-Contained File" and select my ***.sql file, I get "ERROR 1142 (42000) at line 31: CREATE command denied to user 'root'#'localhost' for table 'account' Operation failed with exitcode 1"
I've attempted to give 'root'#'localhost' all privileges.
I'm guessing there's an issue with privileges. If there's another way to do this, I'd be thrilled to know it. Many thanks!
If what you have is a sql dump file then try this on the CLI:
mysql -h hostname -u user --password=password databasename < filename
Assuming of course that has the right privileges.
Non-coder here, please advise as newbie.
In that case, download heidisql : https://www.heidisql.com/
It also makes copying tables and database from server to server very easy.
Apart from that: there is most likely something wrong with your privileges. But you might have made that worse by trying to give privileges to root. The root user can already do everything. So maybe also have a look at this post : How can I restore the MySQL root user’s full privileges?

How to create database using XAMPP shell

I want to install Magento on my localhost, using xampp shell. I've been busting my ass on the same error for hours now.
This is my code so far
set folder="mystore"
set password="mypassword"
set ip="localhost"
md %folder%
cd %folder%
echo CREATE DATABASE %folder% | mysql -u root -p
After i do this, i get prompted to type in the password. If i do type in the password i get the error 1045 access denied for user 'root'#'localhost' using password yes error, but if i just press enter, i lets me through (atleast i think) but i get another error - error 1064 at line 1, you have an error in your sql syntax
I've been googling solution, tried different variations like:
CREATE DATABASE mystore
CREATE DATABASE "mystore"
CREATE DATABASE 'mystore'
but nothing works. I've just started using xampp and shell and i'm still a newbie, so please help :(
After another few hours i came across some linux website where i found the solution. Can't believe the answe is that easy, but i guess as long as you are newbie at one thing, you can easily miss those things. Anyway, here's the solution
instead of "", ' ' or even nothing in CREATE DATABASE, use ``
Example.
Not working
echo CREATE DATABASE %folder% | mysql -u root -p
Working
echo CREATE DATABASE `mystore` | mysql -u root -p

Xampp manager on Mac OSX, recently the mysql server stopped starting

I tried everything, changing the port no. and all but it still did not start I had to end the mysql process using the activity monitor and now the tables wont respond. When I click the name it shows an error message: #1146 table 'table_name' doesn't exist!
My past projects will be wasted if they don't respond and I had forgotten to export the databases.
you can run this command to repair any database you have:
mysqlcheck -u mysql_username -p database_name
but if you see this error after running this:
Error: Table 'database_name.table_name' doesn't exist
you should drop your damaged table, all details can you find through this link

Tried to create DB with Django by mistake

So I read somewhere that Django doesn't create the DB in production on MySQL. It only created the tables and you have to create the DB in MySQL before you can do syncdb. However, I made the mistake of doing syncdb when the database with the name in my.cnf didn't exist. And now I'm locked out of mysql. I can't log into it using mysql -u root -p. It gives me error: ERROR 1049 (42000): Unknown database
Figured it out. Just comment out the part specific to the database in which Django tried to create tables (in the file my.cnf). Then you should be able to log into MySQL.

Get database hosted on MySQL server

Im trying to create my own database with MySQL Workbench and run some queries on it. I have MySQL server 5.1 running and can enter queries in the command line tool to ask for version number and such.
But how do I get the server to host the database that I created in Workbench? When I enter "use MijnDatabase" or "-u root#localhost -p MijnDatabase" it says the database cannot be found. This makes sense, "MijnDatabase" the database file name and it's not connected to the server in any way (also tried with "mydb" wich is the db name I see inside Workbench).
Anyway I'm missing the link between MySQL server and hosting an actual database file.
When you create a database use only lower case letters and use underscore to separate words:
create database my_database;
use my_database;
show tables;
etc...
To connect to your database use:
mysql -u root -p
enter your password then
use my_database;
show tables;
etc...
I have not used MySQL Workbench but the command line and phpMyAdmin. I suggest you start using the command line to learn a little bit MySQL, then use a GUI tool. However the command line is your best teacher.
Have a look in the reference doc: http://dev.mysql.com/doc/refman/5.1/en/create-database.html
. Lean how to create a user and grant him permission on the database.