1. Install wget command
Yum-y Install wget
2, can also directly copy 64-bit, through the command download: wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
3.
Unzip TAR-ZXVF mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz Copy the extracted MySQL directory cp-r mysql-5.6.33-linux-glibc2.5-x86_64/usr/ Local/mysql
4.
| 1234 |
#添加用户组groupadd mysql#添加用户mysql 到用户组mysqluseradd-g mysql mysql |
5. Installation
| 123456789101112131415161718192021222324252627282930 |
cd/usr/local/mysql/<br>mkdir./data/mysqlchown-R mysql:mysql ././scripts/mysql_install_db--user=mysql --datadir=/usr/local/mysql/data/mysqlcpsupport-files/mysql.server /etc/init.d/mysqldchmod755 /etc/init.d/mysqldcpsupport-files/my-default.cnf /etc/my.cnf#修改启动脚本vi/etc/init.d/mysqld#修改项:basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql#启动服务service mysqld start#测试连接./mysql/bin/mysql-uroot#加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了exportPATH=$PATH:/usr/local/mysql//bin<br>source/etc/profile #启动mysqlservice mysqld start#关闭mysqlservice mysqld stop#查看运行状态service mysqld status |
6.
After installation because MySQL has been in the/var/lib/mysql/directory to find/mysql.sock
While the file is actually under/tmp/mysql.sock, execute the following command
Ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock
7.
#1. Stop the MySQL database
/etc/init.d/mysqld stop
#2. Execute the following command
Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
#3. Log in to the MySQL database using root
Mysql-u Root MySQL
#4. Update the root password
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
#最新版MySQL请采用如下SQL:
mysql> UPDATE user SET Authentication_string=password (' NewPassword ') where user= ' root ';
#5. Refresh Permissions
mysql> FLUSH privileges; (or restart host)
#6. Quit MySQL
Mysql> quit
#7. Log back in to MySQL with the root user
Mysql-uroot-p
Enter Password: < Enter the newly set password newpassword>
Some basic MySQL operations:
Create Database Db_mblog;
Use Db_mblog;
--Modified to UTF-8
Show variables like '%character% ';
Set Character_set_server=utf8;
show databases;
Set Names utf8;--Setup encoding
source/home/abc/abc.sql;--Execute Script
Show tables;
Linux installation MySQL