MySQL SUSE SLES11 installation and configuration notes

Source: Internet
Author: User
Tags mysql command line

The following articles mainly introduce the actual operation process of MySQL SUSE SLES11 installation and configuration notes. We will demonstrate how to install MySQL 5 and MySQL 4 in two different versions in Linux, the following describes the specific content of the article.

Install MySQL5.0 in Redhat9.2

Fedora7 install MySQL

(1) download

Download the latest version 5.1.45 from the MySQL official website. For simplicity, download the RPM version of SLES11 directly:

 
 
  1. MySQL-server-community-5.1.45-1.sles11.i586.rpm  
  2. MySQL-client-community-5.1.45-1.sles11.i586.rpm  
  3. MySQL-shared-community-5.1.45-1.sles11.i586.rpm 

My personal opinion on the choice of MySQL version. If it is a product that first considers stability and performance, the function is sufficient. The version should be cautious and conservative, but it does not matter if it is used for general development.

(2) install MySQL SUSE SLES11

1. rpm Installation

 
 
  1. Run: rpm-ivh MySQL-server-community-5.1.45-1.sles11.i586.rpm
  2. Preparing... ######################################## ### [100%]
  3. 1: mySQL-server-community ################################### ####### [1, 100%]
  4. MySQL 0: off 1: off 2: on 3: on 4: on 5: on 6: off
  5. Please remember to set a password for the MySQL root USER!
  6. To do so, start the server, then issue the following commands:
  7. /Usr/bin/MySQLadmin-u root password 'new-password'
  8. /Usr/bin/MySQLadmin-u root-h ss-server password 'new-password'
  9. Alternatively you can run:
  10. /Usr/bin/MySQL_secure_installation
  11. Which will also give you the option of removing the test
  12. Databases and anonymous user created by default. This is
  13. Stronugly recommended for production servers.
  14. See the manual for more instructions.
  15. Please report any problems with the/usr/bin/MySQLbug script!
  16. Starting MySQL. done
  17. Giving MySQLd 2 seconds to start

Using ps-ef | grep MySQL, you can see that msyqld has been started. Netstat-nat: the default port 3306 is already being monitored. Rpm installation is indeed simple enough.

Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN

However, the installation path is not specified by default, so MySQL will not install MySQL SUSE SLES11 to the desired location. So I had to come back and uninstall it first:

Rpm e MySQL-server-community-5.1.45-1.sles11

Use the -- prefix option to reinstall:

Rpm-ivh -- prefix =/work/soft/database/MySQL/MySQL-server-community-5.1.45-1.sles11.i586.rpm

Result error:

 
 
  1. error: package MySQL-server-community is not relocatable  

I cannot find the MySQL SUSE SLES11 installation path again, which is troublesome. Just download the tarbell' example mysql-5.1.45.tar.gz and compile it by yourself.

2. Compile

. /Configure -- prefix =/work/soft/database/MySQL/MySQL5.1 -- localstatedir =/work/soft/database/MySQL/MySQLdata -- with-charset = utf8 -- with-extra-charsets = all -- with-client-ldflags =-all-static -- with-MySQLd-ldflags =-all-static -- with-unix-socket-path =/work/soft/database/ mySQL/tmp/MySQL. sock

Configure is interrupted due to an error:

 
 
  1. checking for termcap functions library... configure: error: No curses/termcap library found 

Install this item first

 
 
  1. gunzip ncurses-5.7.tar.gz  
  2. tar xvf ncurses-5.7.tar  
  3. cd ncurses-5.7/  
  4. ./configure  
  5. make  
  6. make install 

After ncurses is installed, re-configure is successful. Continue to make and make install to complete MySQL SUSE SLES11 compilation.

Then execute scripts/MySQL_install_db.

 
 
  1. Installing MySQL system tables...  
  2. OK  
  3. Filling help tables...  
  4. OK  
  5. To start MySQLd at boot time you have to copy  
  6. support-files/MySQL.server to the right place for your system  
  7. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !  
  8. To do so, start the server, then issue the following commands:  
  9. /work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root password 'new-password'  
  10. /work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root -h ss-server password 'new-password'  
  11. Alternatively you can run:  
  12. /work/soft/database/MySQL/MySQL5.1/bin/MySQL_secure_installation  
  13. which will also give you the option of removing the test  
  14. databases and anonymous user created by default. This is  
  15. strongly recommended for production servers.  
  16. See the manual for more instructions.  
  17. You can start the MySQL daemon with:  
  18. cd /work/soft/database/MySQL/MySQL5.1 ; /work/soft/database/MySQL/MySQL5.1/bin/MySQLd_safe &  
  19. You can test the MySQL daemon with MySQL-test-run.pl  
  20. cd /work/soft/database/MySQL/MySQL5.1/MySQL-test ; perl MySQL-test-run.pl  
  21. Please report any problems with the /work/soft/database/MySQL/MySQL5.1/bin/MySQLbug script!   

Next, it is very important to set the startup of MySQLd:

 
 
  1. cp support-files/MySQL.server /etc/init.d/MySQL  
  2. chkconfig MySQL on  

For convenience, add the bin directory of MySQL to PATH and add myslq/bin to/etc/profile. By the way, add two aliases to facilitate operations:

 
 
  1. export PATH=$JAVA_HOME/bin:$SOFT_ROOT/database/MySQL/MySQL5.1/bin:$PATH  
  2. alias MySQL_start="MySQLd_safe&" 
  3. alias MySQL_stop="MySQLadmin -uroot -p shutdown" 

3. Configuration

Follow the recommended standard settings and add MySQL user and group: however, after the above MySQL SUSE SLES11 installation process is complete, the user and group named MySQL already exists:

 
 
  1. ss-server:/etc # groupadd MySQL  
  2. groupadd: Group `MySQL' already exists.  
  3. ss-server:/etc # useradd MySQL -g MySQL  
  4. useradd: Account `MySQL' already exists.  

Run the ps command.

 
 
  1. ss-server:/etc # ps -ef | grep MySQL  
  2. root 3743 1 0 18:58 ? 00:00:00 /bin/sh 
    /work/soft/database/MySQL/MySQL5.1/bin/MySQLd_safe --datadir=
    /work/soft/database/MySQL/MySQLdata --pid-file=/
    work/soft/database/MySQL/MySQLdata/ss-server.pid  
  3. MySQL 3799 3743 0 18:58 ? 00:00:00 /work/soft/database/MySQL/MySQL5.1
    /libexec/MySQLd --basedir=/work/soft/database/MySQL/MySQL5.1 
    --datadir=/work/soft/database/MySQL/MySQLdata --user=MySQL --log-error
    =/work/soft/database/MySQL/MySQLdata/ss-server.err --pid-file=/work/soft
    /database/MySQL/MySQLdata/ss-server.pid  

Here, MySQLd is started as a MySQL user.

The following are the standard MySQL SUSE SLES11 installation settings

1. Set the password for the root account

 
 
  1. MySQLadmin -u root password 'yourpassword'  

2. to log on to MySQL on the local machine, you need to delete the empty password account for anonymous connection on the local machine, and allow the root user to log on remotely.

 
 
  1. MySQL -uroot -p 

Then enter the password set above and run the following command in the MySQL command line after Logon:

 
 
  1. MySQL>use MySQL;  
  2. MySQL>delete from user where password="";  
  3. MySQL>update user set host = '%' where user = 'root';  
  4. MySQL>flush privileges;  
  5. MySQL>quit  

For the root account, if you consider security, you should create another account for remote logon. the root account does not have to enable remote logon. However, for general use, there are not many security requirements, allowing the root user to log on remotely for convenient management. After all, it is much easier to use the graphical interface of the dedicated management software for operations.


 

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.