In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "the process of installing and configuring mysql under the virtual machine". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First, install MySQL.
[root@sample ~] # yum-y install mysql-server ← install MySQL
Setting up Install Process
Setting up repositories
Dag 100% | = | 1.1 kB 00:00
Update 100% | = | 951B 00:00
Base 100% | = | 1.1 kB 00:00
Addons 100% | = | 951B 00:00
Extras 100% | = | 1.1 kB 00:00
Reading repository metadata in from local files
Primary.xml.gz 100% | = | 106 kB 00:00
Update: # 261/261
Added 5 new packages, deleted 0 old in 2.02 seconds
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
-> Populating transaction set with selected packages. Please wait.
-> Downloading header for mysql-server to pack into transaction set.
Mysql-server-4.1.20-1.RHE 100% | = | 29 kB 00:00
-> Package mysql-server.i386 0vl 4.1.20-1.RHEL4.1 set to be updated
-> Running transaction check
-- > Processing Dependency: libmysqlclient.so.14 (libmysqlclient_14) for package: mysql-server
-- > Processing Dependency: perl-DBD-MySQL for package: mysql-server
-- > Processing Dependency: perl-DBI for package: mysql-server
-- > Processing Dependency: perl (DBI) for package: mysql-server
-- > Processing Dependency: mysql = 4.1.20-1.RHEL4.1 for package: mysql-server
-- > Processing Dependency: libmysqlclient.so.14 for package: mysql-server
-- > Processing Dependency: libmysqlclient_r.so.14 (libmysqlclient_14) for package: mysql-server
-- > Processing Dependency: libmysqlclient_r.so.14 for package: mysql-server
-> Restarting Dependency Resolution with new changes.
-> Populating transaction set with selected packages. Please wait.
-> Downloading header for perl-DBD-MySQL to pack into transaction set.
Perl-DBD-MySQL-2.9004-3.1% | = | 5.4 kB 00:00
-> Package perl-DBD-MySQL.i386 0 2.9004-3.1 set to be updated
-> Downloading header for mysql to pack into transaction set.
Mysql-4.1.20-1.RHEL4.1.i3 100% | = | 35 kB 00:00
-> Package mysql.i386 0vl 4.1.20-1.RHEL4.1 set to be updated
-> Downloading header for perl-DBI to pack into transaction set.
Perl-DBI-1.40-8.i386.rpm 100% | = | 11 kB 00:00
-> Package perl-DBI.i386 0RU 1.40-8 set to be updated
-> Running transaction check Dependencies Resolved====
Package Arch Version Repository Size
=
Installing:
Mysql-server i386 4.1.20-1.RHEL4.1 update 9.8m
Installing for dependencies:
Mysql i386 4.1.20-1.RHEL4.1 update 2.9m
Perl-DBD-MySQL i386 2.9004-3.1 base 111k
Perl-DBI i386 1.40-8 base 466 kTransaction Summary
=
Install 4 Package (s)
Update 0 Package (s)
Remove 0 Package (s)
Total download size: 13 M
Downloading Packages:
(1x4): perl-DBD-MySQL-2.9 100% | = | 111 kB 00:00
(2cap 4): mysql-server-4.1.2 100% | = | 9.8 MB 00:11
(3x4): mysql-4.1.20-1.RHE 100% | = | 2.9 MB 00:03
(4 kB 4): perl-DBI-1.40-8.i3 100% | = | 466 kB 00:01
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-DBI # [1/4]
Installing: mysql # [2/4]
Installing: perl-DBD-MySQL # [3/4]
Installing: mysql-server # [4amp 4] Installed: mysql-server.i386 0purl 4.1.20-1.RHEL4.1
Dependency Installed: mysql.i386 0rig 4.1.20-1.RHEL4.1 perl-DBD-MySQL.i386 0vir 2.9004-3.1 perl-DBI.i386 0vir 1.40-8
Complete!
Then, install the tool "php-mysql" for PHP to access the MySQL database.
[root@sample ~] # yum-y install php-mysql ← install php-mysql
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
-> Populating transaction set with selected packages. Please wait.
-> Downloading header for php-mysql to pack into transaction set.
Php-mysql-4.3.9-3.15.i386 100% | = | 18 kB 00:00
-> Package php-mysql.i386 0RU 4.3.9-3.15 set to be updated
-> Running transaction check Dependencies Resolved====
Package Arch Version Repository Size
=
Installing:
Php-mysql i386 4.3.9-3.15 update 35 kTransaction Summary
=
Install 1 Package (s)
Update 0 Package (s)
Remove 0 Package (s)
Total download size: 35 k
Downloading Packages:
(1ax 1): php-mysql-4.3.9-3. 100% | = | 35 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-mysql # [1Compact 1] Installed: php-mysql.i386 0purl 4.3.9-3.15
Complete!
During my own installation process, the above steps were omitted and started directly from below.
Configure MySQL
Then, configure MySQL.
[root@sample ~] # vi / etc/my.cnf ← edits the configuration file of MySQL
[mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
Old_passwords=1 ← finds this line and adds a new rule below this line so that the default encoding of MySQL is UTF-8
Default-character-set = utf8 ← add this line
Then add the following statement to the end of the configuration file:
[mysql]
Default-character-set = utf8
2008-1-14 when importing data, we found that the utf8 character set could not import Chinese characters, and finally changed utf8 to gbk to solve the problem. But on 2008-1-16, when we actually deployed the application, we found that gbk still didn't work, changed it to gb2312, and then re-imported the database.
Start the MySQL service
Start MySQL and let MySQL start automatically with the system after the system reboots.
[root@sample ~] # chkconfig mysqld on ← sets the MySQL service to start automatically when the system starts
[root@sample ~] #
Chkconfig-- list mysqld ← confirms MySQL self-startup
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← if 2Murray 5 is on, then OK.
[root@sample ~] #
/ etc/rc.d/init.d/mysqld start ← starts the MySQL service
Initializing MySQL database: [OK]
Starting MySQL: [OK] MySQL initial environment setting
[1] set the password for root users of MySQL
When MySQL was first installed, its root users were not set a password. First, set the root password for MySQL.
[root@sample ~] # mysql-u root ← logs in to the MySQL server with the root user
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 2 to server version: 4.1.20 Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > select user,host,password from mysql.user; ← to view user information
+-+
| | user | host | password | |
+-+
| | root | localhost | | ← root password is empty |
| | root | sample.centospub.com | | ← root password is empty |
| | sample.centospub.com |
| | localhost |
+-+
4 rows in set (0.00 sec) mysql > set password for root@localhost=password ('enter root password here'); ← sets root password
Query OK, 0 rows affected (0.01 sec) mysql > set password for root@'sample.centospub.com'=password ('enter the root password here'); ← sets the root password
Query OK, 0 rows affected (0.01 sec) mysql > select user,host,password from mysql.user; ← to view user information
+-+
| | user | host | password | |
+-+
| | root | localhost | 19b68057189b027f | ← root password is set |
| | root | sample.centospub.com | 19b68057189b027f | ← root password is set |
| | sample.centospub.com |
| | localhost |
+-+
4 rows in set (0.01sec) mysql > exit ← quit the MySQL server
Bye
Then, test whether the root password is valid.
[root@sample ~] # mysql-u root ← logs in with root with an empty password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
This error message in ← indicates that the password is set successfully.
[root@localhost ~] #
Mysql-u root-h sample.centospub.com ← logs in with root with an empty password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
This error message in ← indicates that the password is set successfully.
[root@sample ~] #
Mysql-u root-p ← login with root with password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
← confirms that you can log in successfully with a password
Your MySQL connection id is 5 to server version: 4.1.20 Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > exit
Bye
[root@sample ~] #
Mysql-u root-h sample.centospub.com-p ← login with root via password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
← confirms that you can log in successfully with a password
Your MySQL connection id is 6 to server version: 4.1.20Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > exit ← exits the MySQL server
Bye
[2] Delete anonymous users
Just after MySQL is installed, there are users with empty usernames and passwords. This makes it possible for the database server to log in without a password. In order to eliminate the hidden trouble, delete anonymous users.
[root@sample ~] # mysql-u root-p ← login with root via password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 7 to server version: 4.1.20
Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > select user,host from mysql.user; ← to view user information
+-- +
| | user | host |
+-- +
| | localhost |
| | root | localhost |
| | sample.centospub.com |
| | root | sample.centospub.com |
+-- +
4 rows in set (0.02 sec) mysql > delete from mysql.user where user=''; ← delete anonymous users
Query OK, 2 rows affected (0.17 sec) mysql > select user,host from mysql.user; ← to view user information
+-- +
| | user | host |
+-- +
| | root | localhost |
| | root | sample.centospub.com |
+-- +
2 rows in set (0.00 sec) mysql > exit ← exit MySQL server
Bye
[3] Delete the test database
After MySQL is installed, there is an empty database named test, which is deleted. Note here that there is also a database called mysql by default, which is used for system management, so please do not delete it.
[root@sample ~] # mysql-u root-p ← login with root via password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 8 to server version: 4.1.20 Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > show databases; ← to view the existing database of the system
+-+
| | Database |
+-+
| | mysql |
| | test |
+-+
2 rows in set (0.02 sec) mysql > drop database test; ← delete the empty database named test
Query OK, 0 rows affected (0.07 sec) mysql > show databases; ← to view the existing database of the system
+-+
| | Database |
+-+
| | mysql | ← confirms that the database named test has been deleted and no longer exists |
+-+
1 row in set (0.00 sec) mysql > exit ← exit MySQL server
Bye Test MySQL
Let's test MySQL. This includes creating new users and trying to create databases and data tables with instructions for database operations on relational databases. Here, the new user takes centospub as an example.
[root@sample ~] # mysql-u root-p ← login with root via password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 9 to server version: 4.1.20
Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > grant all privileges on test.* to centospub@localhost identified by 'defines the password here; ← establishes a user named centospub who has full access to the test database
Query OK, 0 rows affected (0.03 sec) mysql > select user from mysql.user where user='centospub'; ← confirm whether the centospub user exists or not
+-+
| | user |
+-+
| | centospub | ← confirms that centospub has been established |
+-+
1 row in set (0.01sec) mysql > exit ← quit the MySQL server
Bye
[root@sample ~] #
Mysql-u centospub-p ← logs in to the MySQL server with the newly created centospub user
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 10 to server version: 4.1.20
Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > create database test; ← sets up a database called test
Query OK, 1 row affected (0.00 sec) mysql > show databases; ← to view the existing database of the system
+-+
| | Database |
+-+
| | test |
+-+
1 row in set (0.00 sec) mysql > use test ← connects to the database
Database changed
Mysql >
Create table test (num int, name varchar (50)); ← creates tables in the database
Query OK, 0 rows affected (0.03 sec) mysql > show tables; ← to view tables that already exist in the database
+-+
| | Tables_in_test |
+-+
| | test |
+-+
1 row in set (0.01 sec) mysql > insert into test values; ← inserts a value into the table
Query OK, 1 row affected (0.02 sec) mysql > select * from test; ← to view the information of tables in the database
+-+ +
| | num | name |
+-+ +
| | 1 | Hello World! | |
+-+ +
1 row in set (0.00 sec) mysql > update test set name='Hello everyone updated; ← updates table information and assigns new values
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql > select * from test; ← to view the information of tables in the database
+-- +
| | num | name |
+-- +
| | 1 | Hello Everyone! | ← confirms that it has been updated to the new value |
+-- +
1 row in set (0.01 sec) mysql > delete from test where num=1; ← deletes values in the table
Query OK, 1 row affected (0.00 sec) mysql > select * from test; ← confirm deletion result
Empty set (.01 sec) mysql > drop table test; ← delete table
Query OK, 0 rows affected (0.01 sec) mysql > show tables; ← view table information
Empty set (0.00 sec) ← confirmation table has been deleted mysql > drop database test; ← delete the database named test
Query OK, 0 rows affected (0.01 sec) mysql > show databases; ← to view existing databases
Empty set (0.01sec) ← confirms that the test database has been deleted (non-root user relationship here, no database named mysql can be seen) mysql > exit ← exits the MySQL server
Bye
Then, delete the legacy users that have been tested.
[root@sample ~] # mysql-u root-p ← login with root via password
Enter password: ← enter your password here
Welcome to the MySQL monitor. Commands end with; or / g.
Your MySQL connection id is 12 to server version: 4.1.20 Type 'help;' or' / h' for help. Type'/ c'to clear the buffer.mysql > revoke all privileges on *. * from centospub@localhost; ← revokes the operation rights of the centospub user to the database
Query OK, 0 rows affected (0.00 sec) mysql > delete from mysql.user where user='centospub' and host='localhost'; ← delete centospub user
Query OK, 1 row affected (0.01sec) mysql > select user from mysql.user where user='centospub'; ← to find the user centospub and confirm whether it has been deleted or not
Empty set (0.01sec) ← confirms that mysql > flush privileges; ← refresh does not exist for centospub users to make the above operation effective
Query OK, 0 rows affected (0.01 sec) mysql > exit
Bye
Finally, restart the HTTP service so that php-mysql is reflected in the HTTP service.
[root@sample ~] # / etc/rc.d/init.d/httpd restart ← restart the HTTP service
Stopping httpd: [OK]
Starting httpd: [OK]
How to execute the sql statement file: # mysql-uroot-p123456
< /tmp/mydata.sql 查看mysql的版本:select version();grant all privileges on *.* to usr@localhost identified by '123456'; MySQL客户端不能连接解决办法放开3306端口:/sbin/iptables -A INPUT -i eth0 -p tcp --dport 3306 -j ACCEPT /sbin/iptables -A INPUT -i eth0 -p udp --dport 3306 -j ACCEPT 给用户授权: mysql>Grantallprivilegeson*.*to'yourname'@'%' identified by'youpasswd';Query OK, 0 rows affected (0.05 sec) mysql > flush privileges;Query OK, 0 rows affected (0.06 sec)
The key is flush privileges; grandma's solution to install ssh because there is no installation of telnet and ftp services, so you have to install other remote operation software, namely Secure CRT and Secure FX. This installation is no big deal, it just needs to be cracked. Many commands of Linux basic Linux are similar to unix, but there are many differences. 1. Check disk space: df2, Nic configuration After vi / etc/sysconfig/network-scripts/ifcfg-eth0 configuration, restart the network command: / etc/rc.d/init.d/network restart3, compression command tar-cvfz / tmp/etc.tar.gz / etc/*, compress under etc to / tmp, decompress tar-xvfz * .gz4, restart reboot5, Mount / dev/cdrom automatically mounts the optical drive to / media/cdrecorder this directory is created automatically. When uninstalling the optical drive, be careful to exit the / media/cdrecorder directory. Otherwise, prompt device busy installation java to download the java file name is j2sdk-1_4_2_16-linux-i586-rpm.bin first change the file properties, can be executed Chmod axix j2sdk-1_4_2_16-linux-i586-rpm.bin is executed as follows: #. / j2sdk-1_4_2_16-linux-i586-rpm.bin-mode=console the result is to generate a j2sdk-1_4_2_16-linux-i586-rpm file and then execute: # rpm-ivh j2sdk-1_4_2_16-linux-i586-rpm is generally installed under / usr/java/j2sdk1.4.2_16 Then set / etc/profile and mainly add the following sentences # Path manipulation JAVA_HOME=/usr/java/j2sdk1.4.2_16 CLASSPATH=/usr/java/j2sdk1.4.2_16/lib/dt.jar:/usr/java/j2sdk1.4.2_16/lib/tools.jar:/usr/java/j2sdk1.4.2_16/lib:/usr/java/j2sdk1.4.2_16:.:/usr/java/j2sdk1.4.2_16/bin PATH=$PATH: $HOME/bin:.:/usr/java/j2sdk1.4.2_16
Installation of weblogic began to directly use a previous version under linux, the installation failed, the specific reason is unknown, probably due to the version. . / server816_linux32.bin 1. Graphical interface installation if linux is equipped with a graphical interface, you can install it under the graphical interface, run directly. / server816_linux32.bin, and then create the derver of weblogic. Finally, the user name is weblogic and the password is weblogic. Second, character interface installation if there is no graphical interface, execute. / server816_linux32.bin-mode=console, character interface installation, according to the prompts to install it, the process reference is as follows: a. A brief introduction. Select next.
b. After the file extract is finished, start the installation. First, read a license agreement.
Select 1 and agree to start installation 2. Disagree
c. Select the bea product catalog and select the default option, next.
d. Select installation type, select install all, next.
e. Select the installation directory of weblogic, select the default, next.
f. Start installing files. Third, configure the web server domain and web server to enter / weblogic81/common/bin command line mode startup configuration:. / config.sh-mode=consolea. Pop up the screen and select Create a new WebLogic configuration. Continue b. Select Basic WebLogic Server Domain 8.1.5.0 to continue. c. Do you want to run the wizard in express mode? Select no to continue. d. By selecting Configure the Administration Server, you can configure the server name and listen on the port. E.Do you want to configure Managed Servers, Clusters and Machines, choose no, continue. F.Do you want to configure JDBC (Java Database Connectivity)? Select no to continue. G.Do you want to configure JMS (Java Messaging Service)? Select no to continue. H.Do you want to configure Advanced Security? Select no to continue. i. Whether to change its default user name, password, after modification to continue j.Domain Mode Configuration, select development mode, continue k.Java SDK Selection, you can choose 3, and then the installation of jdk full path to write, continue m.Select the target domain directory, you can specify the installation of domain directory path. N.Edit Domain Information, you can modify the information of domain. Continue. Fourth, crack weblogic user restrictions after installation, this is an uncracked version, only supports 5 users, so you need to crack, copy the previous cracked files to the corresponding directory can be completed. 5. CAPTCHA problem in practical application, CAPTCHA cannot be displayed mainly because java uses windows graphical package by default, so there will be this situation in linux. If you can use x interface, there will be a graphical package to start directly under the linux graphical interface. But if you use other terminals to start remotely, you will have a problem. Finally, find a way to modify startWebLogic.sh. The blue part is the added content if ["${WLS_REDIRECT_LOG}" = ""] Then echo "Starting WLS with line:" echo "${JAVA_HOME} / bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS}-Dweblogic.Name=$ {SERVER_NAME}-Djava.security.policy=$ {WL_HOME} / server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS}" ${JAVA_HOME} / bin/java ${JAVA_VM}-Djava.awt.headless=true-Dfile.encoding=GBK ${MEM_ARGS} ${JAVA_OPTIONS }-Dweblogic.Name=$ {SERVER_NAME}-Djava.security.policy=$ {WL_HOME} / server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS} else echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}" ${JAVA_HOME} / bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS}-Dweblogic.Name=$ {SERVER_NAME}-Djava.security.policy=$ {WL_HOME} / server/lib/weblogic.policy $ {PROXY_SETTINGS} ${SERVER_CLASS} > "${WLS_REDIRECT_LOG}" 2 > & 1 fi method-the principle of Djava.awt.headless=true should be the same as PJA That is to say, JDK 1.4 contains some API,java.awt.headless parameters similar to PJA, which are switches, which are responsible for choosing between these API and the operating system's API.-Djava.awt.headless=true selects API in JDK 1.4 and no longer calls the operating system's API. In the weblogic816 version, this text can also be found, but it is troublesome. About 173line-Dfile.encoding=GBK is for the application to display the problem in Chinese. 6. Startup stop weblogic start: startWebLogic.sh stop: stopWebLogic.sh of course you can also get the java process number of WebLogic through ps-ef | grep java
Then use kill-9 pid to force the stop of WebLogic. Uninstall: / bea/weblogic81/ uninstall 7, configure the JDBC1 of MYSQL, copy the jdbc file mysql-connector-java-5.0.4-bin.jar of mysql to / bea/weblogic81/server/lib, some of the original versions need to modify startWebLogic.sh, add ${WL_HOME} / server/lib/mysql-connector-java-5.0.4-bin.jar in classpath to load jdbc. But the location of each version of Weblogic classpath seems to be different. 8.1.6 classpath found this sentence in / bea/weblogic/user_projects/domains/mydomain/setDomainEnv.sh, plus CLASSPATH= "${ARDIR} / ant/ant.jar$ {CLASSPATHSEP} ${JAVA_HOME} / jre/lib/rt.jar:$ {WLS_HOME} / lib/mysql-connector-java-5.0.4-bin.jar", in order to find this file. First analyzed startWebLogic.sh to know that we should find setDomainEnv.sh, the configuration of JDBC took two or three days, there is really a kind of feeling of willow and flowers! The process of deploying the application will not be written in detail, everyone's situation is different, only a few problems encountered. Linux system character set is not Chinese, loacle-a view the system character set, there is already a Chinese character set, and then modify the / etc/profile, and finally add export LANG=zh_CN.GB2312 to solve the Chinese display problem is mysql case-sensitive, pay attention to consistent with the program on it. With regard to the case of mysql, the following is a repost, which feels good for your reference: MYSQL queries are case-insensitive by default, for example:
Mysql > create table T1 (
-> name varchar (10)
Query OK, 0 rows affected (0.09 sec)
Mysql > insert into T1 values ('you'), (' You'), ('YOU')
Query OK, 3 rows affected (0.05sec)
Records: 3 Duplicates: 0 Warnings: 0
For this table, by default, the results of the following two queries are the same:
Mysql > select * from T1 where name = 'you'
+-+
| | name |
+-+
| | you |
| | You |
| | YOU |
+-+
3 rows in set (0.00 sec)
Mysql > select * from T1 where name = 'YOU'
+-+
| | name |
+-+
| | you |
| | You |
| | YOU |
+-+
3 rows in set (0.00 sec)
If you want MYSQL to know whether the letters you entered are uppercase or lowercase, modify the table:
Mysql > alter table T1 change name name varchar (10) binary
Query OK, 3 rows affected (0.20 sec)
Records: 3 Duplicates: 0 Warnings: 0 mysql > select * from T1 where name = 'you'
+-+
| | name |
+-+
| | you |
+-+
1 row in set (0.00 sec)
Mysql > select * from T1 where name = 'YOU'
+-+
| | name |
+-+
| | YOU |
+-+
1 row in set (0.00 sec)
If you just want to do it in a SQL statement:
Mysql > select * from T1 where name = binary 'YOU'
+-+
| | name |
+-+
| | YOU |
+-+
1 row in set (0.02 sec)
Mysql > select * from T1 where name = binary 'you'
+-+
| | name |
+-+
| | you |
+-+
1 row in set (0.00 sec)
If you don't want to go to so much trouble and want to match the case as soon as the service is turned on:
You can modify my.ini or my.cnf
[mysqld]
Lower_case_table_names=1
(0: distinguishing; 1: indistinguishing)
Then restart the MYSQL service.
Mysql > show variables like'% case_table%'
+-+ +
| | Variable_name | Value |
+-+ +
| | lower_case_table_names | 1 | |
+-+ +
1 row in set (0.00 sec)
Note: the WINDOWS system does not need to be modified. The default is 1.
The default for the LINUX system is 0. Because scripts under LINUX are case-sensitive.
This is the end of the process of installing and configuring mysql under the virtual machine. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.