How to installing MySQL server on CentOS 5 x64
-
1. Login as root user to server.
2. Execute following commands from
shell:
# yum install mysql mysql-server
mysql-devel
This command will check system configuration and calculates the dependencies required to run Mysql. It will display the list of packages need to be installed and in the end:
……
Total download size: 35 M
is this ok [y/N]: y
Press ‘y’ like above. This will install mysql server and mysql client on your machine.
This command will check system configuration and calculates the dependencies required to run Mysql. It will display the list of packages need to be installed and in the end:
……
Total download size: 35 M
is this ok [y/N]: y
Press ‘y’ like above. This will install mysql server and mysql client on your machine.
3. Now mysql is installed on your
server. Now if you execute the following command to connect to mysql
# mysql
And error message like this below is printed:
ERROR 2002 (HY000): Can’t connect to
local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Then it means mysql is not running. You need to start the mysql service first. So execute following command:
# /etc/init.d/mysqld start
It will print the following message:
Starting MySQL: [ OK ]
It means everything is fine. Mysql is up and running and ready to connect on default port 3306.
Then it means mysql is not running. You need to start the mysql service first. So execute following command:
# /etc/init.d/mysqld start
It will print the following message:
Starting MySQL: [ OK ]
It means everything is fine. Mysql is up and running and ready to connect on default port 3306.
4. Now you can connect to mysql from
shell prompt. Execute following command:
# mysql
You might get this error message:
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
Now you might think that you have not provided password that is why above error message. So you try again using -p option like this
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
Oops error message again. The Mysql is installed with blank password, so you must be wondering what went wrong. But you need to check with which user name mysql has been installed. (In my case MySQL is installed with default user ‘mysql’).
You need to check ‘/etc/my.cnf’ file and check following ‘user’ property in ‘mysqld’ section:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
So like above ‘mysql’ is default user with blank password. Now you can connect as follow (As password is blank so hit enter when asked to enter password.):
# mysql -u mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
5. OK. Good going till now. When you
try to execute “use mysql;” command and if you get error message like this -
ERROR 1045 (28000): Access denied
for user ”@’localhost’ (using password: NO)
Then you must be wondering what the hell happened. I mean even If not root then atleast mysql user should have been able to execute all the SQL statements like - create database, alter database, or even a simple use or select statement, but it is not happening. Somehow it seems that mysql user has no priviledges. Now follow below points. Come out of the mysql prompt using quit command or Ctrl+C
Then you must be wondering what the hell happened. I mean even If not root then atleast mysql user should have been able to execute all the SQL statements like - create database, alter database, or even a simple use or select statement, but it is not happening. Somehow it seems that mysql user has no priviledges. Now follow below points. Come out of the mysql prompt using quit command or Ctrl+C
6. Stop mysql server by executing
following command:
# /etc/init.d/mysqld stop.
Once you get the success message go
to step 7.
7. Start MySQL in safe with skipping
grant tables that stores the password. Execute following command:
# mysqld_safe –skip-grant-tables
8. Now connect to mysql server as
root user :
# mysql –user=root
9. Now change the password by
executing following commands and then exit:
# mysql > update user set
Password=PASSWORD(’new-password’) where user=’root’;
# mysql > flush privileges;
# mysql > exit;
Here new-password should have value which you want to have for root user while connecting to MySQL server.
10. Now Reconnect to mysql-server
using ‘new-password’ you set in step 9:
# mysql -u mysql -p
Enter password:
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
Now you are connected to mysql with
root privileges.
Must say that overall I am really impressed with this blog. It is easy to see that you are passionate about your writing. If only I had your writing ability I look forward to more updates and will be returning.
ReplyDeletehttp://www.conenpanama.org |
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well..
ReplyDeletehttp://www.tgihealthcareprofessionals.com |
You may post on the professional credentials for the blog owner. You could express it's outstanding. Your blog experience can springboard your click through.
ReplyDeletewww.spanien-transport.org |
You might write about the services on the blog. You should disclose it's refreshing. Your blog conclusion could accelerate your shoppers.
ReplyDeletemyhavenhomes.com |
It is really a nice and useful piece of information. I am glad that you shared this helpful information with us. Please stay us up to date like this. Thank you for sharing.
ReplyDeleteauto-satisfait.com |
Fantastic post however I was wanting to know if you could write a litte more on this subject? I'd be very thankful if you could elaborate a little bit more. Cheers!
ReplyDeletehttp://www.luzmiamihomes.com |
With a lot of secrets out there people can never deny why there are so many inspectors.
ReplyDeletewww.metrasafety.com |
Hi there, its pleasant article about media print, we all understand media is a fantastic source of information.
ReplyDeletehttp://www.yourhautecouture.com |
I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much.
ReplyDeletenysmallbusinesshub |
I'm now not sure the place you are getting your information, but good topic. I must spend a while finding out more or understanding more. Thank you for fantastic information I used to be searching for this info for my mission.
ReplyDeletecoloradoweddingday.com |
Thanks for the information! Now I know what i will do the next time i travel. Looking forward to go to Thailand later this year! Thanks for some pointers!
ReplyDeletepetseminar |
Hi my loved one! I wish to say that this article is awesome, great written and include almost all significant infos. I would like to see more posts like this .
ReplyDeletebusinessjetpeople.com |
this is so fun to read keep posting such information
ReplyDeletebirkenstock outlet
ReplyDeletemichael kors handbags
nike air huarache
discount oakley sunglasses
christian louboutin sale
christian louboutin
polo ralph lauren outlet online
true religion outlet store
michael kors handbags outlet
cheap air max
zhi20161228