Steps for installing and configuring MySql in SuseLinux10-MySQL

Source: Internet
Author: User
This article describes how to install and configure MySql in SuseLinux10. This article describes the installation steps in detail. For more information, see Installation environment:
Operating system: suse Linux 10
Database: MySQL 5.0.22

I hope to know more experts and learn and discuss technologies with each other!

First, let's let it go. I have read N articles on mysql installation on the internet. most of them are similar, but mysql installation cannot be good. more or less there are problems. I personally think most of them are in the original article, copying data to their respective blogs or some online websites is purely a theft! We started to plan to install suse and mysql last weekend. it was not until this afternoon that we finally arrived at show databases. it was so dizzy! Now I will install mysql in every step here, so that users can check it in case they will observe it again in the future;

Note: When installing suse linux, you must choose C/C ++ for development. let's hear from our predecessors.

Installation steps:

1.download software package mysql-5.0.22.tar.gz, address http://www.mysql.com, general not recommended installation rpm form;

2.put the downloaded mysql-5.0.22.tar.gz in the usr directory and decompress it:

The code is as follows:


# Tar zvxf mysql-5.0.22.tar.gz


3. # cd mysql-5.0.22 // enter the decompressed file directory;

4../configure -- prefix =/usr/local/mysql -- with-charset = gbk // Set the installation directory. Note that the front part is the./configure dot bar;

5. Compile: # make // only one make is enough.

6. install: # make install // both steps take some time

7. after installation, add a mysql User Group and set permissions:

The code is as follows:


# Useradd mysql
# Cd/usr/local/mysql

# Bin/mysql_install_db -- user = msyql

# Chown-R root: mysql.

# Chown-R mysql var

# Chgrp-R mysql.

# Cp share/mysql/my-large.cnf/etc/my. cnf


It is clear that there are some small points behind it;

8. set the mysql service to start from startup:

The code is as follows:


# Cp/usr/local/mysql/share/mysql. server/etc/init. d/mysql

# Chmod 755/etc/init. d/mysql

# Chkconfig -- add mysql

#/Etc/init. d/mysql start


My linux is suse, so init. d is under etc. Other possible locations are different;

Then restart the system: reboot.

9. run mysql

Start mysql at the terminal:

Start service: service mysql start

The code is as follows:


# Cd/usr/local/mysql/bin

#./Mysql-u root-p


Enter password:

Enter your password to access mysql;

10. you can also manually start the mysql service:

The code is as follows:


#/Usr/local/mysql/bin/mysqld_safe -- user = root & // start MySQL


11. change the password: You can also set it like this.

#/Usr/local/mysql/bin/mysqladmin-u root password "your password" // change the password

12. close the mysql service:

The code is as follows:


#/Usr/local/mysql/bin/mysqladmin-u root-pmysqlsecret shutdown // close MySQL


In this way, the rest is only about database operations. it's just a sigh of relief !!

13. forgot to uninstall mysql:

Enter the file decompressed by mysql.

The code is as follows:


# Mysql-5.0.22/cd/usr/

# Make uninstall


Finally, you can delete the unwanted mysql folder, which is more thorough!

The code is as follows:


Mysql> grant all privileges on *. * to 'root' @ '%'
-> Identified by 'root' with grant option;
Query OK, 0 rows affected (0.05 sec)

Mysql> select host, user from mysql. user;
+ ---------------- + -------- +
| Host | user |
+ ---------------- + -------- +
| 192.168.61.113 | root |
| Localhost | jason |
| Localhost | prod |
| Localhost | qsrock |
| Localhost | radius |
| Localhost | root |
+ ---------------- + -------- +


Use the methods described on the Internet to change the password of the root user:

The code is as follows:


# Mysqladmin-uroot-p password 'newpassword'
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Access denied for user' root' @ 'localhost' (using password: YES )'


Now I have found the solution as follows (please test method 3 first, thank you !) :
Method 1:

The code is as follows:


#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root ';
Mysql> flush privileges;
Mysql> quit

#/Etc/init. d/mysql restart
# Mysql-uroot-p
Enter password: <输入新设的密码newpassword>

Mysql>

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.