how to set up mysql database on local machine

please can somebody tell me how to set up a mysql database on a local machine?

Not sure what you mean; if you mean start using mysql, then
mysql -u root
will get you started but you then need to give yourself a root password, remove the anonymous users, add normal users and grant them privileges. There are various threads on these issues and there is info mysql to consult.

If you mean you want to move an existing mysql database to your local machine, the easiest way is to back it up with mysqldump and then start mysql as described above and enter
source <filename>
If you have backed up all the databases on the other machine including the user database, you will find that all the other users and their privileges have been transferred at the same time. Then you need to
flush privileges;
and you will effectively have a clone of what was on the other machine.

ok i tried that ‘mysql -u root’ and got ’ (ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysql/mysql.sock’ (2))
any ideas?

On Wed, 16 Mar 2011 19:06:02 +0000, lukemersh wrote:

> ok i tried that ‘mysql -u root’ and got ’ (ERROR 2002 (HY000): Can’t
> connect to local MySQL server through socket ‘/var/run/mysql/mysql.sock’
> (2))
> any ideas?

Try starting the daemon.

sudo /etc/init.d/mysqld start

You might want to do some reading at http://dev.mysql.com/doc/ to learn
how to use the product.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

tried that and got:
@linux-qc6t:~> sudo /etc/init.d/mysqld start
root’s password:
sudo: /etc/init.d/mysqld: command not found

Have you installed it? It is difficult for us to guess what you did, what you did not, what you allready read/studied and what not when you talk to us in one and a half line messages.

im sure i have installed it via yast. maybe i should download it manually??

Why download manualy? I only asked if you have installed it. Do not try to make it more difficult as it is.

When you have installed it (either using YaST or zypper), you could go to YaST > System > System services (runlevel). Look there for mysql in the llist and change it to yes. This should start the daemon (and also on boot).

cool, you was right, it wasnt on doh…

On 2011-03-16 21:06, lukemersh wrote:

> sudo: /etc/init.d/mysqld: command not found

No final ‘d’. Or “rcmysql start”, as root.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

On Wed, 16 Mar 2011 21:50:06 +0000, Carlos E. R. wrote:

> On 2011-03-16 21:06, lukemersh wrote:
>
>> sudo: /etc/init.d/mysqld: command not found
>
> No final ‘d’. Or “rcmysql start”, as root.

My bad, somehow I thought it identified as such. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Go to YaST>System>System services and set mysqld to Yes. It will then start the mysqld daemon every time you boot; sorry I should have thought of that first in my original reply.