How to install MySql in Linux

Source: Internet
Author: User
Tags localhost mysql

Create users and user groups first
Su-Root
Groupadd MySQL
Useradd-G MySQL decompress the binary file.
Tar zxvf mysql-5.0.51a-linux-i686.tar.gz
Copy the directory/home/MySQL to/usr/local. Create the MySQL license table:
[Root @ localhost root] # cd/usr/local/MySQL
[Root @ localhost MySQL] # scripts/mysql_install_db -- user = MySQL sets binary ownership to be owned by root and belongs to the MySQL Management Group:
[Root @ localhost MySQL] # chown-r root/usr/local/MySQL
[Root @ localhost MySQL] # chgrp-r MySQL/usr/local/MySQL:
[Root @ localhost MySQL] # chown-r MySQL/usr/local/MySQL/Data start server: different database servers use different commands to start the server, for example, if I install the MySQL-server-5.1.7-0.i386.rpm, so use it at startup
[Root @ localhost root] # service MySQL start instead of [root @ localhost root] # service mysqld start
Then it is shown as follows:
Starting MySQL success!
The errors may be as follows:
[Root @ localhost MySQL] # bin/MySQL-umysql
Error 2002 (hy000): Can't connect to local MySQL server through socket '/tmp/MYS
QL. Sock '(2)
Solution:
I went to the mysql. Sock file, under the/var/lib/MySQL. Sock directory, and then found the/tmp directory.
Then, log in as follows:
[Root @ localhost MySQL] # bin/MySQL-uroot-P
Enter password:
Welcome to the MySQL monitor. commands end with; or/g.
Your MySQL connection ID is 4
Server version: 5.1.7-beta
Type 'help; 'or'/H' for help. type'/C' to clear the buffer.

Here are some of my operations. You can also see some information:
Mysql> show databases;
+ --------------------- +
| Database |
+ --------------------- +
| Information_schema |
| Cluster_replication |
| MySQL |
| Test |
+ --------------------- +
4 rows in SET (0.13 Sec)

Mysql> show tables
->;
Error 1046 (3d000): No Database Selected
Mysql> use test
Database changed
Mysql> show tables
->;
Empty set (0.00 Sec)
Mysql>
The entry method is as follows:
[Root @ localhost MySQL] # bin/MySQL-uroot-P
Enter password:
Welcome to the MySQL monitor. commands end with; or/g.
Your MySQL connection ID is 5
Server version: 5.1.7-beta

Type 'help; 'or'/H' for help. type'/C' to clear the buffer.

Mysql>

My MySQL folder is in the directory/usr/local.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.