Home > Database > Mysql Tutorial > Mysql binary package usage example analysis

Mysql binary package usage example analysis

WBOY
Release: 2023-05-29 18:36:08
forward
1233 people have browsed it

Mysql binary package usage example analysis

1. Before installation, create the mysql user first
[root@linuxprobe_nfs ~]# useradd mysql -s /sbin/nologin -M[root@linuxprobe_nfs ~]# id mysqluid=500(mysql) gid=500(mysql) groups=500(mysql)
Copy after login
2. Download and decompress the software package
[root@linuxprobe_nfs ~]# mkdir /home/chenfan/tools  -p[root@linuxprobe_nfs ~]# cd /home/chenfan/tools在http://dev.mysql.com/downloads/mysql/官网上下载mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs tools]# lsmysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs tools]# tar zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz[root@linuxprobe_nfs tools]# lsmysql-5.5.32-linux2.6-x86_64  mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs local]# mv mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql-5.5.32  ###免编译安装[root@linuxprobe_nfs local]# cd /usr/local[root@linuxprobe_nfs local]# ln -s mysql-5.5.32  mysql  ###此处的软链接为了版本升级提供了便利
Copy after login
3. Initialize the database
[root@linuxprobe_nfs local]# mysql/scripts/mysql_install_db  --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/  --user=mysql###此处如果初始化发生错误,删除data目录下的内容,rm -fr  mysql/data/*,重新初始化。
Copy after login
4. Generate MySQL configuration file
[root@linuxprobe_nfs local]# cd mysql[root@linuxprobe_nfs mysql]# cp support-files/my-small.cnf  /etc/my.cnf
Copy after login
5. Authorization management file
[root@linuxprobe_nfs ~]# chown -R mysql:mysql /usr/local/mysql/[root@linuxprobe_nfs ~]# ls -ld /usr/local/mysql/drwxr-xr-x. 13 mysql mysql 4096 Jun 24 17:21 /usr/local/mysql/
Copy after login
6. Set up a scientific startup method
[root@linuxprobe_nfs mysql]# cp support-files/mysql.server  /etc/init.d/mysqld[root@linuxprobe_nfs mysql]# chmod +x /etc/init.d/mysqld[root@linuxprobe_nfs mysql]# /etc/init.d/mysqld startStarting MySQL... SUCCESS!
[root@linuxprobe_nfs mysql]# chkconfig --add mysqld[root@linuxprobe_nfs mysql]# chkconfig mysqld on[root@linuxprobe_nfs mysql]# chkconfig --list mysqldmysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off### 设置开机自启动mysql
Copy after login
7. Configure MySQL Environment variables
[root@linuxprobe_nfs mysql]# echo 'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile[root@linuxprobe_nfs mysql]# source /etc/profile[root@linuxprobe_nfs mysql]# echo $PATH/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin###此处PATH路径的设置为了后续mysql命令的使用
Copy after login
8.mysql login and password settings
[root@linuxprobe_nfs mysql]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

[root@linuxprobe_nfs mysql]# mysqladmin  -uroot password 'chenfan'###密码的设置[root@linuxprobe_nfs mysql]# mysql -uroot -pEnter password: chenfan###交互式登陆###至此完成MySQL的全部初始安装与配置
Copy after login

The above is the detailed content of Mysql binary package usage example analysis. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template