Linux under source code to build PHP environment MySQL (a)

Source: Internet
Author: User
Tags chmod mysql command line

Now it is midnight, 51 Labor Day is very boring.

Toss it. I can't sleep at all. Then you install a virtual machine on your computer, and then you build a PHP environment on the virtual machine.

First I have to install MySQL.

I found a lot of problems.

。 Let me explain.

The following are the installation steps found on a site:

Main introduction Linux operating system under MySQL source code for a purely manual installation. If you are interested in the actual operation flow of the MySQL source code for a purely manual installation of the Linux operating system, you may want to browse the following article.

1. Implementation of Linux under the pure manual MySQL source code installation, the first to download the MySQL source code, I downloaded the mysql-5.0.87.tar.gz

2. Unzip the tar–xvfmysql-5.0.87.tar.gz

3. Enter MySQL-5.0.87

4. Test the environment and specify the installation folder:./configure--prefix=/usr/local/mysql

5. Compiling: Make

6. Install: sudo make install

7. Implement Linux under the pure manual MySQL source code installation to be configured. First, you can see the installed folders such as the following

Command under Share/mysql: Ls–l | grepmy-

The MySQL configuration files are all out. According to the need to choose one of the copy to/etc under the name my.cnf

/ETC/MY.CNF is the path to the default read configuration file for MySQL

8. Change the writable permission of Var. This is the location of the MySQL database data file, because the background program that executes MySQL with the current user may not have the writable permission of this folder.

chmod 777./var–r

9. Configure the system environment variables. Allows the program to run MySQL directly

The environment variables of the system are placed under/etc/profile, and the user's environment variables are placed under the user's root folder. BASHRC

Configuration of the/etc/profile:

    1. PATH=/usr/local/mysql/bin: $PATH
    2. PATH =/usr/local/ MySQL/libexec: $PATH

10. Initialize the mysqld before starting it. Run mysql_install_db

11. Directly hit mysqld_safe& to start MySQL, due to previously configured environment variables

12. Direct MySQL into MySQL command line control. The default is to log in with the current username. The default root is no password

13. Set the root password: mysqladmin–u rootpassword ' 123456 '

14. Log in as root: mysql–uroot–p

15. Set up the Telnet database. By default, users can log on locally only after they are created.

    1. Update user set Host='% ' where  user= ' Guoyu ';

This is the Guoyu of the user's consent to login to the address to be arbitrary. But does not contain local. In other words, this Guoyu user will not be able to log on locally, only can telnet.

Only the root user has the ability to run this sentence. So you have to log on to the local database as the root user first.

    1. Flush privileges;

16. Stop Mysql:mysqladminshutdown

To run this again the refresh cache talent takes effect.

The above related content is the Linux under the pure manual MySQL source code installation Introduction, hope you can have some gains.

You encounter problems such as the following in the process:one of the problems encountered:

No targets specified and no makefile found. Stop.
Solve:
Yum install gcc gcc-c++ autoconf automake

two problems encountered:Permission denied
Permission denied in Linux

Permission denied occurs when you install something on Linux:
Solution:
Edit/etc/selinux/config. Find this section:
# This file controls the state of the SELinux on the system.
# selinux= can take one of these three values:
# Enforcing-selinux security policy is enforced.
# Permissive-selinux Prints warnings instead of enforcing.
# Disabled-selinux is fully disabled.
Selinux=enforcing


Stare the selinux=enforcing out: #SELINUX =enforcing. Then add a new behavior:
Selinux=disabled
Save. Shut down.
......

Edit/etc/sysconfig/selinux to find:
# This file controls the state of the SELinux on the system.
# selinux= can take one of these three values:
# Enforcing-selinux security policy is enforced.
# Permissive-selinux Prints warnings instead of enforcing.
# Disabled-selinux is fully disabled.
Selinux=enforcing


Assume that SELINUX is already a selinux=disabled. Then you don't have to change it. Or you can put


Selinux=enforcing gaze out, add a new line:
Selinux=disabled
Save, exit.


Suppose you encounter other similar hints:
Cannot restore segment prot after Reloc:permission denied
Which should be the selinux problem and be able to consider shutting it down.
----------------------------------------------------------------


---------------------
The depressing one is. When I shut down selinux, I still can't. Search on Google. Found this


Very practical.
After you have guaranteed SELinux to be disable. Also run under
Chcon-t texrel_shlib_t
such as: chcon-t texrel_shlib_t/path/path/name. So (this file is considered to run the file in detail.)
The above two steps. has already conquered a lot of server problems.

three problems encountered:No root privileges

Solve:

Open terminal, enter [[email protected] ~]# su in terminal


problems encountered four:In tar:/configure,make,make Install classic Four-step, never thought about the process. Just think like a routine, do it.


Unfortunately, this time after the./configure. The following error occurred while make:
Make: * * * No targets specified and no makefile found. Stop.

Solve:
Find relevant information on the Internet. Confirm that the./configure is out of the question. Then looked back, sure enough to find the problem: The last few lines went wrong.

Complete error messages such as the following:
Checking for tgetent in-lncurses ... no
Checking for tgetent in-lcurses ... no
Checking for tgetent in-ltermcap ... no
Checking for tgetent in-ltinfo ... no
Checking for termcap functions Library ... configure:error:No
Curses/termcap Library found

Reason:
Missing ncurses installation package

The workaround:
Download and install the corresponding package
First, suppose your system is the Redhat series:
Yum List|grep ncurses
Yum-y Install Ncurses-devel
Yum Install Ncurses-devel

Second, suppose your system is Ubuntu or Debian:
Apt-cache Search ncurses
Apt-get Install Libncurses5-dev

Pending Installation completed! After. Again./configure, passed smoothly. Then make && make
Install, installation successful, all OK. ~~~

problems encountered in five:Bash:mysql:command not found
Solution:
The first problem is that the path to your MySQL command is below/usr/local/mysql/bin, so when you use the MySQL command directly, the system checks the command below/usr/bin, so it is not found, and the solution is Ln-s/usr/local/ Mysql/bin/mysql/usr/bin can do a link,
The second problem is that you are not assigned password, so mysql-uroot-p
or use relative paths directly./mysql-uroot-p123456

Sweat a piece, install a MySQL encountered so many problems.

Fortunately to finally successfully installed.


Finally, we summarize the installation process:

1. Complete the Linux system under the manual MySQL source code installation, the first to download the MySQL source code, I downloaded the mysql-5.0.87.tar.gz

2. Unzip TAR–XVF mysql-5.0.87.tar.gz

3. Enter MySQL-5.0.87

4. Test the environment and specify the folder to install:./configure--prefix=/usr/local/mysql detects what is missing then installs what. Assuming neither GCC nor g++. If you do not have a compiler, download the RPM package (the compiled binaries) directly and install to the system. For example, here is the command to install GCC (to download this package first, this address has more rpm package download http://mirror.oa.com/SLES10-SP1-RPMS-32/):

sudo rpm-ivh gcc-4.1.2_20070115-0.11.i586.rpm

Some of these RPM packages have been installed in the process. or self-reliance on their own causes can not be installed. You can't install it anyway. Force install and ignore dependent commands

sudo rpm-ivh gcc-4.1.2_20070115-0.11.i586.rpm–-force–nodeps

may have been installed after a series of RMP package, the final completion of the environmental test.

。。

。。。

5. Compiling: Make

6. Install: sudo make install

7. Implement Linux under the pure manual MySQL source code installation to be configured. First, you can see the installed folders such as the following under Share/mysql command:

Ls–l | grep my-

Out is the MySQL configuration file, according to the need to choose one of the copy to/etc under the name MY.CNF/ETC/MY.CNF is the default read the MySQL configuration file path

8. Change the writable permission of Var.

This is the location of the MySQL database data file, because the background program that executes MySQL with the current user may not have the writable permission of this folder.

chmod 777./var–r

9. Configure the system environment variables so that the environment variables of the program system that can run MySQL directly are placed under/etc/profile, and the user's environment variables are placed under the user's root folder. BASHRC (1)/etc/profile configuration: PATH Export Path,/usr/local/mydql/bin is the basic MySQL running program folder, and Libexec is to put MySQL background main program mysqld.

(2). BASHRC Configuration:

Set Path=/usr/local/mysql/bin: $PATH

Set Path=/usr/local/mysql/libexec: $PATH

Export path note here. BASHRC inside is to add a set.

After the configuration is completed, login will be effective.

10. Initialize the mysqld before starting it. Run mysql_install_db

11. Start Mysqld, directly hit the mysqld will be able to, due to the previous configuration of the system environment variables

12. Direct MySQL into MySQL command line control. The default is the current username login, the default root is no password

13. Set the root password: mysqladmin–u root password ' 123456 '

14. Log in as root: mysql–uroot–p

15. Set up the Telnet database. By default, users can log on locally only after they are created. Update user set host= '% ' where user= ' Guoyu '; This is the Guoyu the user's consent to login to the address is changed to arbitrary, but does not contain local. In other words, this Guoyu user will not be able to log on locally, only can telnet. Only the root user has the ability to run this sentence. So you have to log on to the local database as the root user first. Flush privileges; To run this again the refresh cache talent takes effect. The above related content is the Linux under the pure manual MySQL source code installation introduction. Hope you can gain something.

finally on the internet to find the MySQL configuration related information:

1. Configure boot-up service
/sbin/chkconfig httpd on [Set APACHESERVERHTTPD service boot]
/sbin/chkconfig–add mysqld [Add MySQL service to the list of services]
/sbin/chkconfig mysqld on [setting up MySQL service boot]
/sbin/service httpd start [Start httpd Service, independent of boot start]
/sbin/service mysqld start [start MySQL service, independent of boot]

2. Set the MySQL database root account password. The default initialization password is empty ~ ~ ~
mysqladmin-u root password ' new-password ' [pin inside password]

3. Make MySQL database more secure
Mysql-u root-p
mysql> DROP DATABASE test; [Delete test database]
Mysql> DELETE from mysql.user WHERE user = "; [Delete Anonymous Account]
mysql> FLUSH privileges; [Overloaded Permissions]
4. Install the MySQL extension
Yum-y Install MYSQL-CONNECTOR-ODBC mysql-devel libdbi-dbd-mysql
5. Set some initial parameters such as default encoding (MY.CNF)
Vi/etc/my.cnf
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
Default-character-set=utf8 [Join]
Default-storage-engine=innodb [Join]
Old_passwords=1
[Client]
Default-character-set=utf8 [Join]
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid

Linux under source code to build PHP environment MySQL (a)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.