Steps for installing and configuring MySql in Suse Linux 10, susemysql

Source: Internet
Author: User

Steps for installing and configuring MySql in Suse Linux 10, susemysql

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:
Copy codeThe 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:
Copy codeThe 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:
Copy codeThe 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
Copy codeThe 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:
Copy codeThe 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:
Copy codeThe 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.
Copy codeThe Code is as follows:
# Mysql-5.0.22/cd/usr/

# Make uninstall

Finally, you can delete the unwanted mysql folder, which is more thorough!
Copy codeThe 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:
Copy codeThe 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:
Copy codeThe 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: <Enter the new 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.