how to create database using ssh ?

Status
Not open for further replies.
19 comments
That will work only if you want to use it with your root login. If you want to use it as another user (recomended for security reasons), you'll have to set up permissions for another users through mysql. Use this:

Code:
[B]GRANT USAGE ON mydb.* to db_user@localhost IDENTIFIED BY 'db_passwd';[/B]

Ofcourse, adopt it for your needs.
 
@Mr-R-T
already did search using google and try this not working
@ Hillsid3

[root@server html]# CREATE DATABASE mydatabasename
-bash: CREATE: command not found
 
[root@server]# GRANT USAGE ON mydb.* to root@localhost IDENTIFIED BY 'pass';
-bash: GRANT: command not found


@nidzabg
 
Mate, you gotta login to your mysql server first :)

Code:
[B]mysql[/B] -u [I]username[/I] -p [I]databasename[/I]

And then use the commands provided :)
 
Ofcourse you can create a database through SSH, how else would you create it on application level?!

The forum post you linked to dates to year 2002!
 
THAT'S NO PROOF! Since when is another post a proof to something?

Why do you think mysql socket server is used?! How the hell do you think phpmyadmin works? It connect to a mysql server (just like the mysql ssh command does), and creates a MySQL database using SQL commands.
 
Last edited:
if you mean how to create a DB in mysql then someone already posted above i saw. you should put it in the title or in your first post, that it's about a "MYSQL" database. ;)
 
Same Problem

I am having the same problem, however I when I follow the same steps I get this message.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Any ideas or why am I getting this problem.

Thanks,
Eric
 
First are you the root user when in ssh? Is the server host localhost? Is the port 3306?
Yjose are the defaults and if that is not your setup you will have to login differently.
 
I am in SSH as the root user, I assume the server is the local host, and I have no idea what the port is? How would I look those things up and change them to the correct settings, in the terminal on a Mac? Already in SSH as the root user to the server.


First are you the root user when in ssh? Is the server host localhost? Is the port 3306?
Yjose are the defaults and if that is not your setup you will have to login differently.
 
Status
Not open for further replies.
Back
Top