Home >Database >Mysql Tutorial >How to install mysql under linux
How to install mysql under Linux: First go to the mysql official website to download the compressed package; then decompress the compressed package and enter the mysql directory; finally execute the [./scripts/mysql_install_db --user=mysql] command.
First go to the mysql official website to download the mysql compiled binary installation package, select linux-generic in the Select Platform: option on the download page, and then scroll to the bottom of the page. Download Linux - Generic (glibc 2.5) (x86, 64-bit) for 64-bit systems, and download Linux - Generic (glibc 2.5) (x86, 32-bit) for 32-bit systems
Enter the directory where the installation package is located and execute the command: tar mysql-5.6.17-linux-glibc2.5 -i686.tar.gz
Execute command: cp mysql-5.6.17-linux-glibc2.5-i686 /usr/local/mysql -r
Note: Do not add /
# at the end of the directory ## Add system mysql group and mysql user:
Execute command: groupadd mysql and useradd -r -g mysql mysql ## Install database:to modify the current The directory owner is the mysql user: execute the command chown -R mysql:mysql ./
Install the database: execute the command ./scripts/mysql_install_db --user=mysql
Modify the current directory owner to Root user: Execute the command chown -R root:root ./
Modify the current data directory owner to the mysql user: Execute the command chown -R mysql:mysql data
The database installation is completed
Start mysql service and add startup mysql service:
Add startup: execute command cp support-files/ mysql.server /etc/init.d/mysql, put the startup script in the boot initialization directory
Start the mysql service: execute the command service mysql start
Execute the command: ps -ef|grep mysql See the mysql service description for successful startup, as shown in the figure
#Modify the root user password of mysql, the initial root password is empty: Put the mysql client to the default path:Note: It is recommended to use a soft link instead of directly copying the package file to facilitate the system installation of multiple versions. mysql
More detailed content address above: http://jingyan.baidu.com/article/a378c9609eb652b3282830fd.html
Note:I feel that the series of MySQL 5.7 versions are very abnormal. Whether it is Windows or Linux, there will always be some inexplicable ideas during installation. When I first installed MySQL under Windows, I was young and ignorant and installed version 5.7. As a result, various elusive bugs appeared. I couldn't find them even if I searched online. Finally, I found a person who had the same problem and complained that it was a version problem and pretended to be 5.6. Enough. This time I installed Linux. Being young and frivolous, I forgot the lessons I learned under Windows and installed 5.7. As a result, various bugs kept appearing. Alas, I was still too young. I hope everyone can learn a lesson.
9. Use after installationAfter installation, you can enter mysql -uroot -p, and then enter password to enter mysql.
After entering, you can use various syntaxes of mysql. First, you can view the database: show databases.
The above is the detailed content of How to install mysql under linux. For more information, please follow other related articles on the PHP Chinese website!