Install mysql5.5 on a linux server. The installation procedure is as follows: 1. create a mysql user group and user groupadd mysqluseradd-r-g mysql 2. download mysql, unzip and connect to mysql with a symbol, the latest can go to the http://www.mysql.com to download cd/usr/localwget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.27-linux2.6-x86_64.tar.gztar zxvf mysql-5.5.27-linux2.6-x86_64.tar.gz ln-s mysql-5.5.27-linux2.6-x86_64 mysql
3. go to the mysql directory and change the file to the mysql user and user group cd mysqlchown-R mysql. chgrp-R mysql. www.2cto.com 4. the data files of the mysql database are separated from the directories of the mysql database for ease of management and segmentation. I am storing the cd/logsmkdir mysqldata5 under/logs/mysqldata. Install the data files of the database, after installation, change the user of the mysql-related files to rootcd/usr/local/mysqlscripts/mysql_install_db -- user = mysql -- datadir =/logs/mysqldatachown-R root.
Change the created data file to mysqlchown-R mysql/logs/mysqldatachgrp-R mysql/logs/mysqldata 6. copy the configuration and startup file to the relevant directory cp support-files/my-medium.cnf/etc/my. cnfcp support-files/mysql. server/etc/init. d/mysql. server7. since there is no password after installation, you cannot log on to the server normally. You can start it in installation mode, then change the password bin/mysqld_safe -- user = mysql -- datadir =/logs/mysqldata & the above is executed in the mysql directory. If you want to execute it in any directory, you need to put the mysql installation directory in path. You can execute the env command to view the path content www.2cto.com and execute vi/etc/profile to modify the configuration file. Add the following at the end: PATH =/usr/local/mysql/bin: $ PATH: wq save and exit
Execute source/etc/profile to make the settings take effect immediately 8. after logging on to mysql, change the root password to start mysql in safe mode, and run mysql-uroot to log on directly and run: use mysql; update user set password = password ('Modified password'); exit after modification; exit mysql command line 9. after modification, modify the mysql Startup File and restart mysql to execute vi/etc/init. d/mysql. modify the basic directory and data directory to: basedir =/usr/local/mysqldatadir =/logs/mysqldata and then run:/etc/init. d/mysql. server restart mysql now, mysql installation is complete, and some optimizations will be introduced later, including Master/Slave configuration, disaster recovery, and cluster.