Study with me in linux 17

Source: Internet
Author: User
Learn about linux with me 17-Linux Enterprise Application-Linux server application information. The following is a detailed description. Let's proceed with 16 lessons.
1. The latest version is mysql6.0. We recommend that you do not download it because it is still under development. You 'd better select the version that supports c ++/c.
[Root @ zy jishu] # md5sum mysql-5.1.20-beta-linux-i686-icc-glibc23.tar.gz
Check whether the verification code is correct
[Root @ zy jishu] # tar zxvf decompress mysql
[Root @ zy jishu] # cd mysql-5.1.20-beta-linux-i686-icc-glibc23
Enter this directory
[Root @ zy mysql-5.1.20-beta-linux-i686-glibc23] #./configure -- sysconfdir =/etc
I really crashed, but I still couldn't install it. It's depressing. Let's see if you can install it yourself.
Here I plan to download the rpm version and install it directly. To download the rpm version, we need to download the service and client progrem.
If the error is reported, most of the ftp://ftp.hostrino.com/pub/fedoralegacy/fedora/1/ OS /i386/ is your dbi is not installed, go here to download and install my perl-DBI-1.37
2. [root @ zy jishu] # rpm-ivh perl-DBI-1.37-1.i386.rpm
[Root @ zy jishu] # rpm-ivh MySQL-server-5.1.20-0.glibc23.i386.rpm Installation server
[Root @ zy jishu] # rpm-ivh MySQL-client-5.1.20-0.glibc23.i386.rpm
3. [root @ zy jishu] # netstat-tnl check whether mysql starts mysql. The default port is 3306.
The command used to log on to MySQL is mysql. the syntax of mysql is as follows:
Mysql [-u username] [-h host] [-p [password] [dbname]
Username and password are the username and password of MySQL respectively. The initial management account of mysql is root, and there is no password. Note: This root user is not a Linux system user. The default MySQL user is root. Because there is no password at first, you only need to type mysql for the first time.
[Root @ zy jishu] # mysql
Ctrl + c Exit
Database directory/var/lib/mysql/
Configuration File/usr/share/mysql (mysql. server command and configuration file)
Related commands/usr/bin (mysqladmin mysqldump and other commands)
Start script/etc/rc. d/init. d/(start script file mysql directory)
MySQL does not have a password by default. You need to add a password after installation.
4. [root @ zy jishu] #/usr/bin/mysqladmin-u root password zhaoyong set the password to zhaoyong for the root user
Now, you need to enter a password to log on. The logon method is
[Root @ zy jishu] # mysql-u root-p
Enter password: Enter the password zhaoyong.
[Root @ zy jishu] # chkconfig -- list check whether mysql is in the auto start service group. mysql is started in 2.3.4.5,
[Root @ zy root] # chkconfig mysql off disable auto-start
[Root @ zy root] # chkconfig mysql on
5. the mysql STARTUP script is stored in the/etc/rc. d/init. d/directory.
[Root @ zy root] #/etc/init. d/mysql start
Starting MySQL SUCCESS!
If you want to disable mysql
[Root @ zy root] #/etc/init. d/mysql stop
Shutting down MySQL. SUCCESS!
6. The default data file storage directory of MySQL is/var/lib/mysql. If you want to move the directory to/home/data:
[Root @ zy root] #/etc/init. d/mysql stop first stop mysql
[Root @ zy root] # create the date directory by mkdir/home/date
[Root @ zy root] # mv/var/lib/mysql/home/date/move this directory
7. Transfer the profile my-medium.cnf to the etc directory and change it to mysql. cnf
Note that the configuration file here is in/usr/share/mysql, which contains several files for different configuration computers and can be used in principle, I chose a medium. You can also choose lager.
[Root @ zy etc] # cp/usr/share/mysql/my-medium.cnf/etc/mysql. cnf
8. Edit the MySQL configuration file [root @ zy etc] # vi mysql. cnf
Because we change the default data file storage directory of MySQL to/var/lib/mysql to/home/date. To ensure that MySQL works properly, we need to specify the location where the mysql. sock file is generated. Modify socket =/var/lib/mysql. change sock line to socket =/home/date/mysql. sock, you can see that it is divided into the client and the server. You 'd better modify the client, that is, to modify it twice.
9. Similarly, modify the startup script.
[Root @ zy etc] # vi/etc/rc. d/init. d/mysql
Change datadir =/var/lib/mysql
Datadir =/home/date/mysql
Then save and exit and start mysql again
[Root @ zy etc] #/etc/init. d/mysql start
Of course, you can put the mysql data storage directory under the var directory as soon as you don't have to pay for it. This saves a lot of trouble. I am here to learn

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.