Home  >  Article  >  Backend Development  >  How to install MySQL_PHP tutorial on UNIX system

How to install MySQL_PHP tutorial on UNIX system

WBOY
WBOYOriginal
2016-07-21 16:03:18813browse

# cd /usr/src
# tar -zvxf mysql-3.22.25-pc-linux-gnu-i686.tar.gz (generate the mysql-3.22.25-pc-linux-gnu-i686 directory)
# cd mysql-3.22.25-pc-linux-gnu-i686
# ./configure --prefix=/usr/local/mysql (where the parameters set the destination installation path)
# make
# make install
Note that when running configure, set the MySQL installation destination path to /usr/local/mysql. This path will be used in subsequent installation processes. Then, create the initial database:
# scripts/mysql_install_db
This command will create two databases under /usr/local/mysql/var/: mysql and test, where the former is MySQL’s permission management database, and the latter This is for you to practice with. Note: If you have installed MySQL before, the initial database already exists and there is no need to reinstall it.
Finally, start MySQL:
# cd /usr/local/mysql/bin
# ./safe_mysqld &
If you want to automatically run the database service when the machine starts, you can start the above The command is added to the /etc/rc.d/rc.local file.
Now, MySQL is running and waiting for your data processing commands! However, be careful: you have not set a password for your root administrator, anyone can modify your database (including the most important permissions database) as they like! If you don’t believe it, do the following exercise (assuming that our current directory is /usr/local/mysql/bin):
Try logging in with any user and run:
$ ./mysql -u root
You can immediately enter the "mysql>" client software prompt and perform any data processing operations without any password; this means that the passwords used by the MySQL administrator "root" account and your Unix account can be different. In order to add a password to the root account, execute:
# ./mysqladmin -u root password 'new password'
Execute again as a normal user:
$ ./mysql -u root
The system will You will be prompted to enter a password. If the password is incorrect, access will be denied. In fact, even if you are a root user, if you do not explicitly specify the password, the system will still refuse:
# ./mysql -u root
or
# ./mysql System response:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
Only when you use the -p parameter and clearly indicate that you want to use a password, the system will prompt you to enter the password, and only when the password is correct Enter:
# ./mysql -u root -p
password:******** (enter password)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 33 to server version: 3.22.25

Type 'help' for help.

Mysql>

Type exit to return to the shell.
The script mysql.server (located in the `share/mysql' directory) is used to start or stop the MySQL server:
shell> mysql.server start
shell> mysql.server stop
This script actually Start the server by executing safe_mysqld. Stopping the server can also be achieved through the management program:
mysqladmin shutdown
You can also add the following command to the `/etc/rc.local' file to automatically start MySQL when the system starts:
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316269.htmlTechArticle# cd /usr/src # tar -zvxf mysql-3.22.25-pc-linux-gnu-i686. tar.gz (generates the mysql-3.22.25-pc-linux-gnu-i686 directory) # cd mysql-3.22.25-pc-linux-gnu-i686 # ./configure --prefix=/usr/loca...
Statement:
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