mariadb数据库监控慢查询问题

求教论坛各位大牛:
监控了两台相同mariadb数据库,都要进行慢查询监控,一台按照网上教程顺利实现,教程详见 http://www.lepus.cc/post/62
但进行第二台慢查询任务部署时,手动执行任务脚本:/usr/bin/pt-query-digest ........... 总是报如下的错:
install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted.
Compilation failed in require at (eval 30) line 3.

at /usr/bin/pt-query-digest line 1001.

注:两台数据库服务器操作完全相同,该装的工具都安装了,如下
# yum -y install perl-DBI

yum -y install perl-DBD-MySQL

yum install perl-IO-Socket-SSL

rpm -ivh percona-toolkit-2.2.6-1.noarch.rpm

找了很多方法都没有解决,两天还没解决,希望各位大牛能帮帮忙支支招,感激不尽!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
mariaDB数据库乱码问题,请大神们请教

SET NAMES UTF8; DROP DATABASE IF EXISTS udisk; CREATE DATABASE udisk CHARSET=UTF8; USE udisk; CREATE TABLE udisk( uid INT PRIMARY KEY AUTO_INCREMENT, pic VARCHAR(32), uname VARCHAR(32), price FLOAT(5,2), addedTime BIGINT ); INSERT INTO udisk VALUES (NULL, 'img/1.jpg','三星','35.5','1234567890123'), 执行这些语句后,中文是显示???乱码,反而注释SET NAMES UTF8;后,显示正常,这是什么原因呢,初学mariaDB,请大神请教

将PHP连接到MariaDB数据库时出错

<div class="post-text" itemprop="text"> <p>I am trying to create a simple web app that prints out database info from MariaDB/MySQL using PHP, im not even at that stage yet... I have trouble when connecting to the database and get the following error:</p> <blockquote> <p>Host '10.155.237.62' is not allowed to connect to this MariaDB server</p> </blockquote> <p>Now, I have not done a secure installation so my Mariadb Server allows access from wildcard host and infact any host.I have also tried the code with the root account but received the same error. Can anyone tell me if its my code or whether its a procedure im not aware of that disallows connectors to access the information?</p> <p>Here is my code:</p> <pre><code>&lt;?php $con=mysqli_connect("vm-007.server.com","testuser","testpass","my_db"); if (mysqli_connect_errno()) { echo "Failed to connect to MariaDB: " . mysqli_connect_error(); } ?&gt; </code></pre> <p>Thanks in advance!</p> </div>

Mariadb 10.3.11 where in 元素个数多个 查询速度慢

发现一个 Mariadb 10.3.11 很坑的问题, 如果 ```where in ( ... )```里面的元素很多, 举个例子 1500 个, SQL 执行速度特别慢, explain 了一下: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20181226132339185.png) 而 在 MySQL 5.7 上的执行速度很快. ![在这里插入图片描述](https://img-blog.csdnimg.cn/20181226132449460.png) 求知道的大佬告知一下.

mariadb数据库乱码,如何解决。

``` String driver ="org.mariadb.jdbc.Driver"; //从配置参数中获取数据库url String url = "jdbc:mariadb://127.0.0.1:3306/maria" + "?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull" +"&transformedBitIsBoolean=true"; //从配置参数中获取用户名 String user = "root"; //从配置参数中获取密码 String pass = "123"; //注册驱动 try { Class.forName(driver); //获取数据库连接 Connection conn = DriverManager.getConnection(url,user,pass); //创建Statement对象 Statement stmt = conn.createStatement(); //执行查询 boolean add = stmt.execute("insert into t_exhibition_user set name = '飞'," +"company = 'yuan',job = 'yuan',phone = '123345678909',is_buy_equipment = 'N'"); ``` 这是我向数据量添加数据的操作,添加失败。错误如下: ``` java.sql.SQLDataException: (conn=15) Incorrect string value: '\x9E' for column 'name' at row 1 at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:225) at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165) at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:238) at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:356) at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:407) at com.ratta.supernote.note.MariadbAndMysql.main(MariadbAndMysql.java:30) Caused by: java.sql.SQLException: Incorrect string value: '\x9E' for column 'name' at row 1 Query is: insert into t_exhibition_user set name = '飞',company = 'yuan',job = 'yuan',phone = '123345678909',is_buy_equipment = 'N' java thread: main at org.mariadb.jdbc.internal.util.LogQueryTool.exceptionWithQuery(LogQueryTool.java:126) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:222) at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:350) ... 2 more ``` 这里的中文导致添加数据失败,而如果使用如何代码则可以添加成功 ``` String driver ="com.mysql.jdbc.Driver"; //从配置参数中获取数据库url String url = "jdbc:mysql://127.0.0.1:3306/maria" + "?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull" +"&transformedBitIsBoolean=true"; //从配置参数中获取用户名 String user = "root"; //从配置参数中获取密码 String pass = "123"; //注册驱动 try { Class.forName(driver); //获取数据库连接 Connection conn = DriverManager.getConnection(url,user,pass); //创建Statement对象 Statement stmt = conn.createStatement(); //执行查询 boolean add = stmt.execute("insert into t_exhibition_user set name = '飞'," +"company = 'yuan',job = 'yuan',phone = '123345678909',is_buy_equipment = 'N'"); ``` 这是为什么呢?数据库是mariadb,数据库字符集如图: ![图片说明](https://img-ask.csdn.net/upload/201903/28/1553770326_818760.png) ![图片说明](https://img-ask.csdn.net/upload/201903/28/1553770341_26610.png) ![图片说明](https://img-ask.csdn.net/upload/201903/28/1553770354_62463.png) 现在不想改变数据库的字符,也不能使用MySQL的连接池驱动,如何才能将中文添成功。 useUnicode=true&characterEncoding=utf-8 这个配置常识过了,没效果。

如何计算每个MariaDB表行中的实际数据大小?

<div class="post-text" itemprop="text"> <p>Is there any techniques to calculate actual used data size per every SQL table row? Including enabled Indexes and Log records? Sum of field sizes would not be correct because some fields can be empty or data is less than field size. Target is to know, how much exactly data is used per user. Probably I can do this in handler side.</p> </div>

授予数据库上的所有权限

<div class="post-text" itemprop="text"> <p>I've created database, for example 'mydb'. </p> <pre><code>CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'myuser'@'%' IDENTIFIED BY PASSWORD '*HASH'; GRANT ALL ON mydb.* TO 'myuser'@'%'; GRANT ALL ON mydb TO 'myuser'@'%'; GRANT CREATE ON mydb TO 'myuser'@'%'; FLUSH PRIVILEGES; </code></pre> <p>Now i can login to database from everywhere, but can't create tables.</p> <p>How to grant all privileges on that database and (in the future) tables. I can't create tables in 'mydb' database. I always get:</p> <pre><code>CREATE TABLE t (c CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin); ERROR 1142 (42000): CREATE command denied to user 'myuser'@'...' for table 't' </code></pre> </div> <p>转载于:https://stackoverflow.com/questions/5016505/grant-all-privileges-on-database</p>

mariadb imp/dmp问题,mariadb是否支持expdp/impdp

mariadb,是否可以导出expdp,impdp,想请教一下装什么mariadb版本数据库比较好

从mySQL切换到mariaDB timestamp messup

<div class="post-text" itemprop="text"> <p>I have switched from MySQL to MariaDB which has caused some "minor" problems. One has been bugging me for hours now and i can't find the solution.</p> <p>I moved my database by exporting it from MySQL and importing it into MariaDB which went well..</p> <p>When one of my update queries did not work i narrowed it down to this function in my database handler:</p> <pre><code>public function updateEquipment($type,$product,$acquisition,$calibration_interval,$equipment_no,$inspection_date,$equipment_id,$active) { $stmt = $this-&gt;conn-&gt;prepare("UPDATE equipment SET type = :type, acquisition = :acquisition, calibration_interval = :calibration_interval, equipment_no = :equipment_no, product = :product, inspection_date = :inspection_date, active = :active WHERE id = :equipment_id"); $stmt-&gt;bindParam(":equipment_id", $equipment_id,PDO::PARAM_INT); $stmt-&gt;bindParam(":type", $type,PDO::PARAM_STR); $stmt-&gt;bindParam(":acquisition", $acquisition,PDO::PARAM_STR); $stmt-&gt;bindParam(":calibration_interval", $calibration_interval,PDO::PARAM_STR); $stmt-&gt;bindParam(":equipment_no", $equipment_no,PDO::PARAM_STR); $stmt-&gt;bindParam(":product", $product,PDO::PARAM_STR); $stmt-&gt;bindParam(":inspection_date", $this-&gt;formatDateStrToTimeStamp($inspection_date),PDO::PARAM_STR); $stmt-&gt;bindParam(":active", $active,PDO::PARAM_INT); return $stmt-&gt;execute(); } </code></pre> <p><strong>formatDateStrToTimeStamp function:</strong></p> <pre><code>private function formatDateStrToTimeStamp($inspection_date) { $day = substr($inspection_date,0,2); $month = substr($inspection_date,3,2); $year = substr($inspection_date,6,4); return date('Y-m-d H:i:s', strtotime($year."-".$month."-".$day)); } </code></pre> <p>As you can see, i have switched out the binding of my inspection_date with a string representing the timestamp i want to update. I tested the statement WITHOUT updating my timestamp and then it was working as expected. As soon as i add the timestamp (in my case i have inserted a static timestamp) the row will NOT update and execute does not return (it should return true or false).</p> <p><strong>Heres my table structure:</strong></p> <pre><code>CREATE TABLE `equipment` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `type` text NOT NULL, `acquisition` text NOT NULL, `calibration_interval` text NOT NULL, `equipment_no` text NOT NULL, `product` text NOT NULL, `inspection_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `active` int(11) NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; </code></pre> <p><strong>Question:</strong> Are timestamps treated different in mariaDB, because i have not made any changes to my code since the switch, and i have simply imported my database from the export i made from my MySQL database. </p> </div>

MariaDB - PHP - 提交表单时未将数据插入表中

<div class="post-text" itemprop="text"> <p>I'm very new to PHP so please bear with me. I have a registration form and I'm submitting the values entered on that form and having them inserted into a Maria Database table, but the data is not being inserted into the table.</p> <p>I did a select * from profileinformation; on the table and the data isn't there.</p> <p>Any help is appreciated and points will be awarded!</p> <p>Here is my HTML Form:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="stylesheet.css"&gt; &lt;title&gt;Registration Page&lt;/title&gt; &lt;script&gt; function validateForm() { var x = document.forms["myForm"]["netID"].value; if (x == null || x == "") { alert("NetID must be filled out"); return false; } var y = document.forms["myForm"]["email"].value; if (y == null || y == "") { alert("Email must be filled out"); return false; } var n = document.forms["myForm"]["fname"].value; if (n == null || n == "") { alert("First Name cannot be blank"); return false; } else if (n.length &lt; 2) { alert("First name cannot be less than 2 characters!"); return false; } var b = document.forms["myForm"]["lname"].value; if (b == null || b == "") { alert("Last Name cannot be blank"); return false; } else if (b.length &lt; 2) { alert("Last Name cannot b less than 2 characters!"); return false; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;center&gt;&lt;img src="KSUlogo.PNG" alt="logo" style="width:100px;height:50px;"&gt;&lt;/center&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;li&gt;&lt;a class="active" href="Welcome.html"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;li&gt;&lt;a href="CSERegistrationPage.html"&gt;Registration&lt;/a&gt;&lt;/li&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;li&gt;&lt;a href="#contact"&gt;Search&lt;/a&gt;&lt;/li&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;li&gt;&lt;a href="#about"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;/ul&gt; &lt;h1 style="text-align:center;"&gt;CCSE Community Profile Page&lt;/h1&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;h2 style="text-align:center;"&gt;Enter your Registration Information&lt;/h2&gt; &lt;div style="text-align:center"&gt; &lt;form name="myForm" action="RegistrationValues.php" onsubmit="return validateForm()" method="post"&gt; &lt;center&gt;NetID: &lt;input type="text" name="netID"&gt;&lt;/center&gt; &lt;br&gt; &lt;center&gt;Email: &lt;input type="text" name="email"&gt;&lt;/center&gt; &lt;br&gt; &lt;center&gt;First Name: &lt;input type="text" name="fname"&gt;&lt;/center&gt; &lt;br&gt; &lt;center&gt;Last Name: &lt;input type="text" name="lname"&gt;&lt;/center&gt; &lt;br&gt; &lt;br&gt; Services You Can Provide the CSE Community&lt;/center&gt;&lt;br&gt; &lt;br&gt; &lt;input type="checkbox" name="radio" value="Java"&gt; Java Tutoring&lt;br&gt; &lt;input type="checkbox" name="radio" value="Computer" checked&gt; Computer Fixing&lt;br&gt; &lt;input type="checkbox" name="radio" value="PHP" checked&gt; PHP Tutoring&lt;br&gt; &lt;br&gt;&lt;br&gt; &lt;select name="availabilty"&gt; &lt;option value="blank"&gt;&lt;/option&gt; &lt;option value="Java"&gt;Morning&lt;/option&gt; &lt;option value="Computer"&gt;Evening&lt;/option&gt; &lt;option value="Service"&gt;Afternoon&lt;/option&gt; &lt;/select&gt; &lt;br&gt;&lt;br&gt; &lt;center&gt;&lt;input type="submit" value="Submit"&gt;&lt;/center&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here is my PHP form:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="stylesheet.css"&gt; &lt;title&gt;Registration Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php include "header.html";?&gt; &lt;?php include "navigation.html";?&gt; &lt;div style="text-align:center"&gt; &lt;p&gt;netID: &lt;?php echo $_POST["netID"]?&gt;&lt;/p&gt; &lt;p&gt;Email: &lt;?php echo $_POST["email"]?&gt;&lt;/p&gt; &lt;p&gt;First Name &lt;?php echo $_POST["fname"]?&gt;&lt;/p&gt; &lt;p&gt;Last Name: &lt;?php echo $_POST["lname"]?&gt;&lt;/p&gt; &lt;?php $netID = $email = $fname = $lname = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $netID = test_input($_POST["netID"]); $email = test_input($_POST["email"]); $fname = test_input($_POST["fname"]); $lname = test_input($_POST["lname"]); } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $servername = "localhost"; $username = "user"; $password = "newpassword"; $dbname = "project"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $conn-&gt;query("insert into ProfileInformation (netID, email, fname, lname, radio, availabilty) values ( '{$_POST['netID']}', '{$_POST['email']}', '{$_POST['fname']}', '{$_POST['lname']}', '{$_POST['radio']}', '{$_POST['availabilty']}' )") or die(mysql_error()); echo "Done!!!!"; $conn-&gt;close(); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Any help is appreciated and thanks in advance!</p> </div>

Mysql递归查询无法在MariaDB上运行

<div class="post-text" itemprop="text"> <p>I have a table "knowledgemodel" [enter image description here][1]</p> <p>My Query </p> <pre><code>SELECT title, id, @parent:=parent_id as prnt FROM (SELECT @parent:=3 ) a JOIN (SELECT * FROM knowledgemodel ORDER BY id DESC) b where @WHERE=id </code></pre> <p><img src="https://i.stack.imgur.com/LSZgm.jpg" alt="enter image description here"></p> <p>IN MYsql Server: 127.0.0.1 via TCP/IP Server type: MySQL Server version: 5.6.16 - MySQL Community Server (GPL) Protocol version: 10 Above Query was working fine.</p> <p>But on MariaDB im getting only one record <img src="https://i.stack.imgur.com/CH7Ao.jpg" alt="enter image description here"></p> <p>Any help ??</p> </div>

使用终端连接到Mariadb

<div class="post-text" itemprop="text"> <p>I use PHP to send a query to the terminal and I want to receive the table that the database produces. I am new to PHP and having difficulties with the connection of the website and the database that I access from the terminal. </p> <pre><code> &lt;?php $con = new mysqli('localhost','root','','db'); $query = ""; if($con-&gt;connect_error) { die("Connection failed: " . $conn-&gt;connect_error); } else { echo "Connection Successful." } if($_SERVER["REQUEST_METHOD"] == ["POST"]) { $query = test_input($_POST["uni_name"]); } $prompt = 'select * from students where university like ' . $query . '%'; $dir = shell_exec("use db"); if($dir == NULL) { $output = shell_exec($prompt); echo "test"; } setModal($output); function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } function setModal($query) { echo '&lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt; &lt;div class="modal-dialog" role="document"&gt; &lt;div class="modal-content"&gt; &lt;div class="modal-header"&gt; &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt; &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt; &lt;/button&gt; &lt;h4 class="modal-title" id="myModalLabel"&gt;Graduate Information&lt;/h4&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; '; echo $query; echo ' &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;Close&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;'; } ?&gt; </code></pre> <p>The setModal function is to create a Bootstrap modal and display the info I get from the database. My main problem is the connection between the database and the website. </p> <p>Thanks in advance.. </p> </div>

MariaDB避免死锁

<div class="post-text" itemprop="text"> <p>My original error was </p> <blockquote> <p>Error No: 1213 - Deadlock found when trying to get lock; try restarting transaction</p> </blockquote> <p>Okay, so I wrote a loop with max retries and a wait in between to try and get through the deadlocks. </p> <pre><code>$Try = 0; while (!$Result = $dbs-&gt;query($MySQL)) { $Try++; if ($Try === MYSQL_MAX_RETRIES) HandleMySQLError($dbs-&gt;error, $MySQL, false, $Test, $Trace); else sleep(MYSQL_RETRY_WAIT); } </code></pre> <p>But now I'm constantly getting some of the original error still, and a new error </p> <blockquote> <p>Got error 35 "Resource deadlock avoided" during COMMIT</p> </blockquote> <p>But I can't really seem to find out what this means or how to fix it?</p> <hr> <p><strong>EDIT</strong></p> <p>I left out a ton of information when I first wrote this, but the server is a RedHat 7 AWS EC2 (well, 3 of them) in a Galera &amp; MariaDB cluster.</p> <p>The query I am running is a call to a stored procedure </p> <pre><code>call`getchatmessages`('&lt;ChatID&gt;','&lt;UserID&gt;',from_unixtime('&lt;Some Timestamp&gt;')); </code></pre> <p>And the stored procedure is as follows</p> <pre><code>CREATE DEFINER=`root`@`%` PROCEDURE `getchatmessages`(IN `__ChatID` CHAR(36), IN `__UserID` CHAR(36), IN `__Timestamp` TIMESTAMP(6)) BEGIN DECLARE `__NewChatMessages` TINYINT(1) DEFAULT 0; DECLARE `__i` INT(11) DEFAULT 0; DECLARE `__Interval` INT(11) DEFAULT 100; -- ms DECLARE `__Timeout` INT(11) DEFAULT 15000; -- ms while `__NewChatMessages`=0 and `__i`&lt;`__Timeout`/`__Interval` do select 1 into `__NewChatMessages` from `chatmessages` where `ChatID`=`__ChatID` and `DateTimeAdded`&gt;ifnull(`__Timestamp`,0) limit 1; update `chatusers` set `DateTimeRead`=now(6) where `ChatID`=`__ChatID` and `UserID`=`__UserID`; do sleep(`__Interval`/1000); set `__i`=`__i`+1; end while; select `chatmessages`.`Body`, `chatmessages`.`ChatID`, `chatmessages`.`UserID`, `chatmessages`.`ChatMessageID`, `chatmessages`.`DateTimeAdded`, UNIX_TIMESTAMP(`chatmessages`.`DateTimeAdded`) `Timestamp`, `users`.`FirstName`, `users`.`LastName` from `chatmessages` join `users` using (`UserID`) where `chatmessages`.`ChatID`=`__ChatID` and `chatmessages`.`DateTimeAdded`&gt;ifnull(`__Timestamp`,0) order by `chatmessages`.`DateTimeAdded` desc limit 100; END </code></pre> </div>

mariadb内存泄漏问题解决

大家好!最近发现我安装mariadb的服务器内存每天都在不断的减少,请教这个是什么情况呢!如何查找问题,如何解决这个问题,目前没有头绪!哪位大神给点指导意见,必将感激涕零!

mariadb安装后,非root无法mysql登录

**系统** ``` Ubuntu 16 ``` **安装方式** ``` sudo apt-get install mariadb-server python-pymysql ``` ** 两个疑问 ** 1. 非系统root不能通过mysql登录 2. MariaDB 接受空用户登录, 如何取消? user表没有 求科普, 感激不尽! ** 说明 ** * mysql已确认开启 ``` nginx@nginx-virtual-machine:~$ service mysql status ● mysql.service - LSB: Start and stop the mysql database server daemon Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled) Active: active (running) since Wed 2017-09-27 19:17:51 ULAST; 16h ago Docs: man:systemd-sysv-generator(8) Process: 29567 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS) Process: 29603 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS) CGroup: /system.slice/mysql.service ├─29633 /bin/bash /usr/bin/mysqld_safe ├─29777 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/m └─29778 logger -t mysqld -p daemon error ``` * root登录 ``` nginx@nginx-virtual-machine:~$ sudo mysql -uroot -psqlpass Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 46 Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | my_test | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]> ``` * 非root登录 ``` nginx@nginx-virtual-machine:~$ mysql -uroot -psqlpass ERROR 1698 (28000): Access denied for user 'root'@'localhost' ``` * root用户, 空用户登录 ``` root@nginx-virtual-machine:/home/nginx# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 48 Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> ``` 但是查询不到默认用户 ``` MariaDB [mysql]> select * from user where 0 = length(User); Empty set (0.00 sec) MariaDB [mysql]> select count(1) from user; +----------+ | count(1) | +----------+ | 1 | +----------+ 1 row in set (0.00 sec) ``` 通过安全加固删除匿名账户后, 任然可以匿名登录. ``` nginx@nginx-virtual-machine:~$ sudo mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! ```

腾讯云装了个mariaDB,可以再装个MYSQL而不会出现问题吗?

腾讯云装了个mariaDB,可以再装个MYSQL而不会出现问题吗?

Mariadb错误:此MariaDB不允许使用该命令

<div class="post-text" itemprop="text"> <p>In mariadb, when I use "load data local infile" into a php script, I get this error message:</p> <blockquote> <p>the used command is not allowed with this MariaDB version for the query load data local infile</p> </blockquote> <p>This is the same thing than on this <a href="https://stackoverflow.com/questions/47940175/load-data-infile-is-not-allowed-mariadb/52993318#52993318">thread</a>.</p> <p>I'm on CentOS 7 - Plesk Onyx and my <code>my.cnf</code> contains:</p> <pre><code>local-infile=1 </code></pre> <p>If I use "load data infile", I can import my csv file into my MySQL table but the csv file must to be located into the directory <code>/var/lib/mysql/my_database/</code></p> <p>But I can't create a csv file into <code>/var/lib/mysql/my_database/</code> from a php script located into <code>/var/www/vhosts/my-website.com/httpdocs/my_script.php</code></p> <p>if I use "load data infile", I can import my csv file into my MySQL table but the csv file must to be located into the directory /var/lib/mysql/my_database/</p> <p>But I can't create a csv file into /var/lib/mysql/my_database/ from a php script located into /var/www/vhosts/my-website.com/httpdocs/my_script.php it doesn't work!</p> <p>What is the solution?</p> </div>

运行此代码后,为什么我的SQL表数据会被删除?

<div class="post-text" itemprop="text"> <p>I have this code that I want to run and it's connected to my database and it uses to show the values on the table but every time I do an UPDATE query.</p> <p>It updates the rest of the row with zeros except the one I've chosen. I want to keep my numbers on the row but only update the one that i chose but I can't figure it out how to!</p> <p>I initialized the table with a row with Zeros (0s) and then with my web page application I want to change those values. </p> <p>But if I have another value on the rest of the columns and I want to change this one, the rest of the values go to zero (the initial state of the table) (I don't know how to explain it better I think)</p> <pre><code>&lt;?php $showData = ("SELECT * FROM horario"); if ($new_user_activity['data'] == 'Seg' ) { $segHora = $new_user_activity['horas']; } $sql = ("UPDATE horario SET seg=$segHora WHERE id=1"); if(!mysqli_query($conn,$sql)) { echo("ERRO NA QUERY" ); } else { if(mysqli_query($conn,$sql)){ $sqlData = mysqli_query($conn,$showData); while ($row = mysqli_fetch_array($sqlData,MYSQLI_ASSOC)){ echo($row['seg']); } } } ?&gt; </code></pre> <p>Its expected to keep my values from the other columns on the same row!</p> <p><a href="https://i.stack.imgur.com/64fk0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/64fk0.png" alt="PICTURE OF WHAT IS HAPPENING TO THE DATABASE"></a></p> </div>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

为什么本科以上学历的人只占中国人口的5%,但感觉遍地都是大学生?

中国大学生占总人口不到5% 2017年,中国整体的本科率仅有5.9%;如果算上研究生,这一比例可以进一步上升到6.5% 为什么在国家统计局推出的这份年鉴中,学历的最高一阶就是到研究生,而没有进一步再统计博士生的数量的。 原因其实并不难理解,相比全国和各省整体人口体量,博士生的占比非常之低,属于绝对意义上的小概率样本。 这一点,我们从上表中的各省研究生占比情况也可以看出端倪。除北京、天津、上海三...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

6年开发经验女程序员,面试京东Java岗要求薪资28K

写在开头: 上周面试了一位女程序员,上午10::30来我们部门面试,2B哥接待了她.来看看她的简历: 个人简历 个人技能: ● 熟悉spring mvc 、spring、mybatis 等框架 ● 熟悉 redis 、rocketmq、dubbo、zookeeper、netty 、nginx、tomcat、mysql。 ● 阅读过juc 中的线程池、锁的源...

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

立即提问
相关内容推荐