Install MySql in Ubuntu Linux

Source: Internet
Author: User

I am learning MySQL now, but I feel uncomfortable using MySQL in windows. I don't know whether it is a limited level or a problem with Windows version features. So I want to install MySql in Linux for learning. Linux is not as friendly as windows, and there is no graphical interface. It took several hours to install it successfully. The following is my installation step: First of all, it must have the installation source, first to mysql.com on the next installation package, now the latest version is 6.0a, http://dev.mysql.com/downloads/mysql/6.0.html#linux, see so many versions, don't be so blind. What I put down is: Linux (non RPM packages) version. This version is directly decompressed and then configured. 2. decompress the downloaded file: Change the folder name to MySQL and copy it to a specific location. I copied it to/usr/local. In a general file browser, copying may result in "no permission. In this case, enter the terminal and enter sudo Nautilus to display a new file browser window. In this window, copy the file. 3. Install the file:
1. # Sudo groupadd MySQL
# Sudo useradd mysql-G MySQL
// Create a MySQL Group
// Create a MySQL user and add it to the MySQL Group
2. # Cp/usr/local/MySQL/support-files/my-medium.cnf/etc/My. CNF There are four template files in the support-Files directory. We select one of the MySQL configuration files to overwrite/etc/My. the configuration file CNF (default system configuration, with performance parameters and some MySQL path parameters set) is very important. You can change the configuration here later.
3. # Cd/usr/local/MySQL
# Sudo./scripts/mysql_install_db -- user = MySQL
Go to the MySQL directory
// Create a table and use a MySQL user to access the table. After the table is initialized, set the access permissions for MySQL and root users.
4. # Sudo chown-r root. // Set root to access/usr/local/MySQL
5. # Sudo chown-r Mysql Data // Set the MySQL user to access/usr/local/MySQL/data, which stores MySQL database files. this directory is in/etc/My. CNF is configured and generated in mysql_install_db.
6. # Sudo chown-r Mysql Data /. // Set the MySQL user to access all files in/usr/local/MySQL/data/MySQL
7. # Sudo chgrp-r MySQL. // Set the MySQL group to access/usr/local/MySQL
8. #/Usr/local/MySQL/bin/mysqld_safe -- user = MySQL & Run MySQL
If there is no problem, a prompt like this should appear:
[1] 42264
# Starting mysqld daemon with databases from/usr/local/MySQL/var
If a statement such as MySQL ended appears, it indicates that MySQL is not started properly. You can go to the log to find the problem,Log files are usually configured in/etc/My. CNF.. Most problems are caused by incorrect permission settings.
9. Run the following command to modify the MySQL password:
#/Usr/local/MySQL/bin/mysqladmin-u Root Password yourpassword
// The default installation password is blank. You must change it immediately for security purposes.
10. Add the Automatic startup service: sudo CP/usr/local/MySQL/support-files/MySQL. Server/etc/rc2.d/s20mysql  
11 Add the MySQL program working directory to the path environment: CP. bashrc. bashrc_bakgedit ~ /. Bashrc // Add: Export Path = $ path:/usr/local/MySQL/bin to the last line and save the file to the terminal. Source ~ /. Bashrc // Back up the original file // update the file
4. restart the computer and use env to check the environment variable path to check whether the file is successfully added. Run MySQL R root-P password test to check whether the MySQL command line can be entered. Congratulations! Installed successfully! If the following prompt appears in step 1 of installation:./bin/mysqld: Error while loading shared libraries: libstdc ++. so.5: cannot open shared object file: no such file or directory
Installation of system tables failed! Enter the installation package manager to search for and install: libstdc ++. so.5. If other packages are prompted, install the required packages first. Finally, I wish you success !!!  

 

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.