Mysql – Setting up a root user password

MySQL

I'm newbie in MySQL. I installed MySQL5.5 Server and Client in my Debian Wheezy. All I did was enter aptitude install myqsl-server. Now, I have no idea what to do!

I found a webpage that says I have to set up a root user password first, and, to do that, I have to enter with the following command:

mysqladmin -u root password NEWPASSWORD

Where "NEWPASSWORD" is, well, the new password. The rest are literally commands. So, I opened my terminal and as normal user, tried to enter with this command and I got this output:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

So, considering all I did, what are the next steps? I have to create a root user password, but for what? And after that what do I have to do to create a simple table representing data?

All tutorials I read on the internet are very difficult to understand!

Best Answer

this alert:

Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

properbly shows that your MySQLd didn't start up,

you could use

ps -ef|grep mysql

or

netstat -ltunp|grep mysql

or

mysqld_multi status

to check your mysqld process status depending on your installation method.

otherwise, strongly reconmmend you always keep your eyes on error log, it will extactly tell you what has happed about the sever! before start mysqld you could watch error log by:

tail -f error.log

meanwhile, do make sure your have installed mysql database, which you might type commands like:

mysql_install_db --datadir=/data/mysqldata3308/mydata/

and check out wether datadir or basedir are owned by USER and GROUP "mysql"

first time install mysql always be not so easy, but with comparing to other commerce database management softwares, MySQL obviouslly are one of the most easiests.