In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
VMware12Pro and virtual machine centos6.5mini under environment win7
Network adapter "bridging mode"
After continuing the last Apache compilation, compile and install MySQL5.6
MySQL5.6 differs from previous versions in that it can be compiled with cmake. Install cmake first.
# yum install cmake-y
1. Start downloading and compiling MySQL5.6. Http://mirrors.sohu.com is recommended.
# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35.tar.gz
# tar xf mysql-5.6.35.tar.gz
# cd mysql-5.6.35.tar.gz
Yum install ncurses-devel-y / / prompts you to rely on ncurses-devel when compiling, delete the unzipped folder, reextract, recompile
Cmake\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\
-DMYSQL_DATADIR=/usr/local/mysql/data\
-DSYSCONFDIR=/etc
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\
Many attempts to compile in the centos6.5mini environment, and many errors, so compile the mysql.sock file to the default directory / tmp/mysql.sock
After the execution of the cmake command, execute the command echo $? If 0 is returned, make & & make install is executed.
This compilation time is longer, mine is 27 minutes, if your configuration is good enough, less time
2. Simple configuration of MySQL
First set up mysql users and groups. Note that mysql users are not allowed to log on to the system, and there is no need to create a home directory!
Groupadd mysql
Useradd-M-s / sbin/nologin-g mysql mysql
Set the owner and group of the MySQL installation directory
Chown-R mysql:mysql / usr/local/mysql
Give database data directory read and write permissions
Chmod 777-R / usr/local/mysql/data
Copy configuration files and service control scripts to the appropriate location
Cp / usr/local/mysql/support-files/my-default.cnf / etc/my.cnf
Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld
Edit the configuration file / etc/my.cnf and add:
Basedir = / usr/local/mysql
Datadir = / usr/local/mysql/data
Other parameters are fine by default.
Here's how to initialize the database
Cd / usr/local/mysql
Scripts/mysql_install_db-user=mysql
Then execute echo $? If the returned status code is 0, the database is initialized successfully
You can start the mysql database service with the startup command mysqld
Service mysqld start
The appearance of "SUCCESS" in uppercase indicates that the startup is successful.
The default password for the mysql server is empty
Execute / usr/local/mysql/bin/mysql to log in to the database (default root user, root of mysql, not system root)
Enter MySQL prompt is "mysql >"
When the show databases; # # command is entered correctly, remember ";"
Use mysql
Select host, user, password from mysql.user
Exit mysql: "\ Q" or "exit"
Remember Apache? Yes, to add the bin of MySQL to the system environment variable
Echo 'export PATH=$PATH:/usr/local/mysql/bin' > / etc/profile.d/mysql.sh
Chmod + x / etc/profile.d/mysql.sh
Source / etc/profile.d/mysql.sh
Log out of the linux system, log in and let the system read the configuration file again, and then you can execute mysql directly without having to write a lengthy path!
Enter mysql to open the mysql client
> show database
> use mysql; # # all your MySQL users, passwords and other information are saved in the user table of this database
> select user, host, password from mysql.user; # # mysql user name authentication is based on user and host
> update user set password=password ('your password') where user='root' and host='127.0.0.1'
> flush privileges; # # Update memory data
> set password for 'root'@'localhost'=password (' your password')
> flush privileges
Several statements commonly used in MySQL:
> create database testdb
> use testdb
> create table mytest (id int (6) unsigned not null auto_increment, name varchar (40), age int (2), college varchar (36), habit blob, primary key (id))
> desc mytest
> insert into mytest (name, age,college,habit) value ('channel', 32,' Xinyang Agricultural Hospital', 'English,boxing')
> select * from mytest
> update mytest set age=26 where name='channel'
> select * from mytest
> grant all privileges on testdb.* to test@'' identified by '12345'
> flush privileges
Criticism and correction of deficiencies
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.