After installing a series of software development programs under Ubuntu10.10 in the early stage, the final database MySQL5.1.56 has been installed. Basically, build LNMJo Based on Java Web Applications
After installing a series of software development programs under Ubuntu 10.10 in the early stage, we have installed the final database MySQL 5.1.56. Basically, build LNMJ o Based on Java Web Applications
After installing a series of software development programs under Ubuntu 10.10 in the early stage, we have installed the final database MySQL 5.1.56. Basically, the environment for building the LNMJ or LAMJ Architecture Based on Java Web applications has been set up. Next, I plan to write an article about Server Load balancer and centralized Memcached clusters in the L (linux) N (nginx) M (mysql) J (java web tomcat) architecture. If you like it, you can install the environment first.
Create MySQL users and groups
Java code
Sudo groupadd mysql
Sudo useradd-r-g mysql
View plaincopy to clipboardprint?
Sudo groupadd mysql
Sudo useradd-r-g mysql
Note:
-R option to create a user that does not have login permissions to your server host. Omit this option to permit logins for the user.
-G: Specifies the group to which the user belongs.
Decompress and move to the application directory
Java code
Tar-zxvf mysql-5.1.56-linux-i686-glibc23.tar.gz
Sudo mv mysql-5.1.56-linux-i686-glibc23/usr/local/mysql51
Establish a soft connection
Create a soft connection to mysql for the mysql51 directory to quickly access the mysql51 directory.
Java code
// Equivalent to cd/usr/local/mysql51 and cd/usr/local/mysql
Sudo ln-s/usr/local/mysql51 mysql
Cd/usr/local/mysql
Access permission Configuration
Java code
Cd/usr/local/mysql
// Note that there is a decimal point
Sudo chown-R mysql.
// Change the group attribute to the mysql group.
Sudo chgrp-R mysql.
There are four symbolic link files whose ownership is not changed (/usr/mysql/lib ).
Lrwxrwxrwx 1 7155 staff 24 Mar 9 libmysqlclient. so.16-> libmysqlclient. so.16.0.0
Lrwxrwxrwx 1 7155 staff 24 Mar 9 libmysqlclient. so-> libmysqlclient. so.16.0.0
Lrwxrwxrwx 1 7155 staff 26 Mar 9 libmysqlclient_r.so.16-> libmysqlclient_r.so.16.0.0
Lrwxrwxrwx 1 7155 staff 26 Mar 9 libmysqlclient_r.so-> libmysqlclient_r.so.16.0.0
Java code
// To change the permissions of the preceding files, run the following command.
@ Linuxidc-laptop:/usr/local/mysql/lib $ sudo chown-h mysql: mysql libmysqlclient. so.16 libmysqlclient. so libmysqlclient_r.so.16 libmysqlclient_r.so
Create MySQL authorization table Initialization
Java code
Sudo scripts/mysql_install_db -- user = mysql
// Change all attributes of the file to the root user.
Sudo chown-R root.
// Change all attributes of the data directory to the mysql user.
Sudo chown-R mysql data
// The following is the permission to get data for everyone. It is only required for convenience of debugging.
Sudo chmod a + rwx-R data
// The following command is optional. Copy the configuration file to the relevant directory
Sudo cp support-files/my-medium.cnf/etc/my. cnf
Start mysql
Sudo bin/mysqld_safe -- user = mysql &
// The following command is optional. Start the mysql. server service from startup.
// To start mysqld at boot time you have to copy
// Support-files/mysql. server to the right place for your system
Sudo cp support-files/mysql. server/etc/init. d/mysql. server
Service mysql. server start
// Check whether the startup is normal
./Bin/mysqladmin version
Sudo scripts/mysql_install_db -- user = mysql
// Change all attributes of the file to the root user.
Sudo chown-R root.
// Change all attributes of the data directory to the mysql user.
Sudo chown-R mysql data
// The following is the permission to get data for everyone. It is only required for convenience of debugging.
Sudo chmod a + rwx-R data
// The following command is optional. Copy the configuration file to the relevant directory
Sudo cp support-files/my-medium.cnf/etc/my. cnf
Start mysql
Sudo bin/mysqld_safe -- user = mysql &
// The following command is optional. Start the mysql. server service from startup.
// To start mysqld at boot time you have to copy
// Support-files/mysql. server to the right place for your system
Sudo cp support-files/mysql. server/etc/init. d/mysql. server
Service mysql. server start
// Check whether the startup is normal
./Bin/mysqladmin version
Sudo scripts/mysql_install_db -- user = mysql
// Change all attributes of the file to the root user.
Sudo chown-R root.
// Change all attributes of the data directory to the mysql user.
Sudo chown-R mysql data
// The following is the permission to get data for everyone. It is only required for convenience of debugging.
Sudo chmod a + rwx-R data
// The following command is optional. Copy the configuration file to the relevant directory
Sudo cp support-files/my-medium.cnf/etc/my. cnf
Start mysql
Sudo bin/mysqld_safe -- user = mysql &
// The following command is optional. Start the mysql. server service from startup.
// To start mysqld at boot time you have to copy
// Support-files/mysql. server to the right place for your system
Sudo cp support-files/mysql. server/etc/init. d/mysql. server
Service mysql. server start
// Check whether the startup is normal
./Bin/mysqladmin version./bin/mysqladmin Ver 8.42 Distrib 5.1.56, for pc-linux-gnu on i686
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with absolutely no warranty. This is free software,
And you are welcome to modify and redistribute it under the GPL license
Server version 5.1.56-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket/tmp/mysql. sock
Uptime: 12 min 41 sec
,