Install MySQL source code in Debian and Debian MySQL source code
Note: root permission is required.
One database installation 1 installation dependency
Cmake, g ++, libncurses5-dev
Install the SDK directly using apt-get install.
2. Create users and directories
Groupadd mysql # Add a user group
Useradd-r-g mysql # Add a user
Mkdir-p/usr/local/mysql # create the installation directory
Chown-R root: mysql/usr/local/mysql # The owner is root and the group is mysql
Mkdir-p/usr/local/mysql/data # create a data storage directory
Chown-R mysql: mysql/usr/local/mysql/data # The owner is mysql and the group is mysql.
3. Download the mysql source code
Download source file: wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz
Unzip: tar zxvf mysql-5.6.16.tar.gz
4. Compile
Cd mysql-5.6.16
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/usr/local/mysql/data
Make & make install
Note: If you re-compile
Make clean & rm CMakeCache.txt
Database 2 configuration 1 initialize Database
Cp support-files/my-default.cnf/etc/my. cnf # change the configuration file location
Scripts/mysql_install_db -- user = mysql # Install a database
Cp support-files/mysql. server/etc/init. d/mysql # Add the mysql startup service to the system service.
Service mysqld start # start the database
2. Set the root user
/Usr/local/mysql/bin/mysql-uroot-p123456 # Set the root user and password
Mysql> grant all privileges on *. * TO root @ "%" identified by "root"; # Add the remote connection capability TO the root user.
Mysql> UPDATE user SET Password = password ('000000') WHERE User = 'root'; # SET the Password
Mysql> SELECT Host, User, Password FROM user; # verify
Mysql> flush privilegs;