Lab Environment:
Ubuntu 14.04
MySQL 5.7.9
First, uninstall the previous MySQL
Please refer to
http://dahui09.blog.51cto.com/10693267/1718431
Second, download the installation package
Address: Http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.9-linux-glibc2.5-x86_64.tar
Third, installation
cd/usr/loca/
1. Compress first
# tar XVF Mysql-5.7.9-linux-glibc2.5-x86_64.tar
2. Unzip)
# tar ZXVF mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
3. Renaming, switching paths
# MV mysql-5.7.9-linux-glibc2.5-x86_64 mysql# CD mysql/
4. Create the Data directory (there is no data directory in 5.7.9), user group
#mkdir data#useradd-r-m-s/sbin/nologin mysql#chown-r mysql.mysql/usr/local/mysql-5.7.9#chown-r Mysql.mysql/usr/lo Cal/mysql
5. Database initialization (there may be warnings OK)
bin/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data--basedir=/usr/local/mysql
#./bin/mysqld_safe–user=mysql &
6. Run MySQL, error errors (Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock '), create A soft connection
# service MySQL Restart #/usr/local/mysql# ln-s/tmp/mysql.sock/var/run/mysqld/mysqld.sock
7. Add in config file
Skip-grant-tables--Skip permissions
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
Port = 3306
8. Add a Startup item
CP Support-files/mysql.server/etc/init.d/mysql
9. Configure the MySQL system environment variables, edit the/etc/profile file
Locate export path in front of add
Export Mysql_home=/usr/local/mysql
Export path= $PATH: ${mysql_home}/bin
After adding the MySQL environment variable, use the Source/etc/profile command to make the environment variable effective in time
Iv. setting the MySQL root password
> UPDATE user SET authentication_string = password (' new-password ') WHERE user = ' root ';> flush privileges;
If you lose the password error, prompt password expires (Error 1862 (HY000): Your password has expired. To log the must change it using a client that supports expired passwords.)
> UPDATE user SET password_expired = ' Y ' WHERE user = ' root ';
Install Ubuntu14.04 under mysql5.7.9