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:
- MySQL-server-community-5.1.45-1.sles11.i586.rpm
- MySQL-client-community-5.1.45-1.sles11.i586.rpm
- 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
- Run: rpm-ivh MySQL-server-community-5.1.45-1.sles11.i586.rpm
- Preparing... ######################################## ### [100%]
- 1: mySQL-server-community ################################### ####### [1, 100%]
- MySQL 0: off 1: off 2: on 3: on 4: on 5: on 6: off
- Please remember to set a password for the MySQL root USER!
- To do so, start the server, then issue the following commands:
- /Usr/bin/MySQLadmin-u root password 'new-password'
- /Usr/bin/MySQLadmin-u root-h ss-server password 'new-password'
- Alternatively you can run:
- /Usr/bin/MySQL_secure_installation
- Which will also give you the option of removing the test
- Databases and anonymous user created by default. This is
- Stronugly recommended for production servers.
- See the manual for more instructions.
- Please report any problems with the/usr/bin/MySQLbug script!
- Starting MySQL. done
- 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:
- 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:
- checking for termcap functions library... configure: error: No curses/termcap library found
Install this item first
- gunzip ncurses-5.7.tar.gz
- tar xvf ncurses-5.7.tar
- cd ncurses-5.7/
- ./configure
- make
- 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.
- Installing MySQL system tables...
- OK
- Filling help tables...
- OK
- To start MySQLd at boot time you have to copy
- support-files/MySQL.server to the right place for your system
- PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
- To do so, start the server, then issue the following commands:
- /work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root password 'new-password'
- /work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root -h ss-server password 'new-password'
- Alternatively you can run:
- /work/soft/database/MySQL/MySQL5.1/bin/MySQL_secure_installation
- which will also give you the option of removing the test
- databases and anonymous user created by default. This is
- strongly recommended for production servers.
- See the manual for more instructions.
- You can start the MySQL daemon with:
- cd /work/soft/database/MySQL/MySQL5.1 ; /work/soft/database/MySQL/MySQL5.1/bin/MySQLd_safe &
- You can test the MySQL daemon with MySQL-test-run.pl
- cd /work/soft/database/MySQL/MySQL5.1/MySQL-test ; perl MySQL-test-run.pl
- 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:
- cp support-files/MySQL.server /etc/init.d/MySQL
- 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:
- export PATH=$JAVA_HOME/bin:$SOFT_ROOT/database/MySQL/MySQL5.1/bin:$PATH
- alias MySQL_start="MySQLd_safe&"
- 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:
- ss-server:/etc # groupadd MySQL
- groupadd: Group `MySQL' already exists.
- ss-server:/etc # useradd MySQL -g MySQL
- useradd: Account `MySQL' already exists.
Run the ps command.
- ss-server:/etc # ps -ef | grep MySQL
- 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
- 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
- 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.
- MySQL -uroot -p
Then enter the password set above and run the following command in the MySQL command line after Logon:
- MySQL>use MySQL;
- MySQL>delete from user where password="";
- MySQL>update user set host = '%' where user = 'root';
- MySQL>flush privileges;
- 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.