Install_mysql_CentOS5.6
Conclusion: in fact, the answer is always in front of us, but we are always easy to ignore them. I thought, quietly, and the answer is there.
1. download mysql-5.1.56.tar.gz to/opt/src
2. $ cd/opt/src
3. $ tar-zxvf mysql-5.1.56.tar.gz
4. $ cd mysql-5.1.56
5. $ mkdir-p/opt/apps/mysql-5.1.56/opt/etc/mysql/opt/var/mysql
/Opt/tmp/mysql
6. $./configure -- prefix =/opt/apps/mysql-5.1.56 /\
-- Sysconfdir =/opt/etc/mysql /\
-- Localstatedir =/opt/var/mysql /\
-- With-unix-socket-path =/opt/tmp/mysql. sock \
-- With-tcp-port = 3306 \
-- With-charset = utf8 \
-- With-extra-charsets = gb2312, gbk
7. $ make
8. $ make install
9. $ su-root
10. $ sudo cp/opt/src/support-files/my-medium.cnf/etc/my. cnf
11. $ sudo groupadd mysql
12. $ sudo useradd-g mysql
13. $ sudo chown-R mysql: mysql/opt/var/mysql
14. $ sudo chown-R mysql: mysql/opt/tmp/mysql/
14. $ ln-s/opt/apps/mysql-5.1.56/opt/apps/mysql
15. $ sudo vim/etc/my. cnf
Instead skip-locking by # skip-locking
Add:
Skip-external-locking
16. $ sudo./mysql/bin/mysql_install_db -- user = mysql
Note:
Generate the initial privileges or grant tables
17. Start the mysql Service
$ Sudo/opt/apps/mysql/bin/mysqld_safe &
Note:
Starts the mysqld_safe daemon, which will in turn start the MySQL server mysqld.
If the mysqld daemon crashes, mysqld_safe will restart it.
The ampersand instructs the shell to run the daemon in the background.
18. Disable mysql Service
$/Opt/apps/mysql/bin/mysqladmin-u root shutdown
19. Set the root password
$/Opt/apps/mysql/bin/mysqladmin-u root password 'new-password'
20. Close the service after setting the password.
$/Opt/apps/mysql/bin/mysqladmin-uroot-ppassword shutdown
Or
$/Opt/apps/mysql/bin/mysqladmin-u root-p shutdown
21. log on to mysql
$ Mysql-u root-p
Or
$ Mysql-uroot-ppasswd
22. Set startup
$ Su-root
# Cp/opt/src/mysql-5.1.56/support-files/mysql. server/etc/init. d/mysql
Note: place the startup file for the server in the server's initial daemons directory
With the name mysql.
# Chmod + x/etc/init. d/mysql
# Chkconfig -- add mysql
Note: set the run level of the service for startup and shutdown
23. Now you can use relevant settings
# Chkconfig mysql off // set not to start randomly
# Chkconfig mysql on // restart immediately
24. It is more convenient to start mysql.
#/Etc/init. d/mysql start // start
#/Etc/init. d/mysql stop // close
#/Etc/init. d/mysql restart
Or
# Service mysql start
....................................
1. error: No curses/termcap library found
Sudo yum install ncurses-devel
Curses forms an encapsulation that works on the underlying Terminal code, and provides users with a flexible and efficient API
(Application Programming Interface Application Interface ). It provides the ability to move the cursor,
Create windows, generate colors, and process mouse operations. So that programmers do not need to care about the underlying
Terminal operations.
Ncurses is a clone of CURSES in the earliest System V Release 4.0 (SVr4. This is
Free-configuration library, fully compatible with the old version of curses. In short, it is a management application at the end of the character
Function library. When it comes to curses later, it can also be exchanged with NCURSES.
2. exec: g ++: not found
Sudo yum install gcc-c ++
3. Error: repeated declaration of C ++ built-in type 'bool'
Try again./configure, and then make.
4. '-- skip-locking' is deprecated and will be removed in a future release. Please use' -- skip-external-locking 'instead .,
5. Execute the script
$ Sudo./mysql/bin/mysql_install_db -- user = mysql
If it appears, have you ever seen it, but I am so stupid to ask people, go to google.
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:
/Opt/apps/mysql-5.1.56/bin/mysqladmin-u root password 'new-password'
/Opt/apps/mysql-5.1.56/bin/mysqladmin-u root-h net.yy.com password 'new-password'
Alternatively you can run:
/Opt/apps/mysql-5.1.56/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.
You can start the MySQL daemon:
Cd/opt/apps/mysql-5.1.56;/opt/apps/mysql-5.1.56/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
Cd/opt/apps/mysql-5.1.56/mysql-test; perl mysql-test-run.pl
Please report any problems with the/opt/apps/mysql-5.1.56/bin/mysqlbug script!