mariadb

TypeError: can only concatenate tuple (not “int”) to tuple

余生长醉 提交于 2021-02-05 11:37:25
问题 i am trying to return a value from db and getting this error.I tried the previously answered questions here,but no luck.Can anyone help me? @frappe.whitelist() def generate_barcode(): last_barcode = frappe.db.sql("""\ select MAX(barcode) from `tabItem` """) if last_barcode: last_barcode = last_barcode + 1 else: x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] random.shuffle(x) last_barcode = x[0] return {'last_barcode':last_barcode} adding traceback: Traceback (innermost last): File "/home/adminuser/frappe

MySQL from decimal(13.6) to currency

a 夏天 提交于 2021-02-05 10:54:25
问题 I'm trying to get from an decimal(13.6) value to currency in EURO's I'm getting this as result right now: ╔══════════════╦═════════╗ ║ total ║ Date ║ ╠══════════════╬═════════╣ ║8887616.500000║ 2017 ║ ╚══════════════╩═════════╝ What I want is something like this one: ╔══════════════╦═════════╗ ║ total ║ Date ║ ╠══════════════╬═════════╣ ║€8,887.616.50 ║ 2017 ║ ╚══════════════╩═════════╝ Or this one: ╔══════════════╦═════════╗ ║ total ║ Date ║ ╠══════════════╬═════════╣ ║ €M8,9 ║ 2017 ║ ╚═════

ContOS安装配置MySQL,redis

做~自己de王妃 提交于 2021-02-05 09:59:51
MySQL(MariaDB) 一,说明 MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。 开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。 也就是说MySQL即将要收费 MariaDB是完全兼容MySQL的,包括API和命令行,使之能轻松成为MySQL的代替品。 Red Hat Enterprise Linux/CentOS 7.0 发行版已将默认的数据库从 MySQL 切换到 MariaDB。 二,添加 MariaDB yum 仓库 当前环境:阿里云的yum源 直接 yum install mariadb 发现版本特别低,还是5.5版本的,官方已经推出10.1版本了 按照程序员的尿性,当然是下载官方最新版啦~ # 首先在 RHEL/CentOS 和 Fedora 操作系统中添加 MariaDB 的 YUM 配置文件 MariaDB.repo 文件。 mkdir mariadb.repo # 然后编辑创建mariadb.repo仓库文件 vi /etc/yum.repos.d/ MariaDB.repo # 再输入 i 进入编辑模式,添加repo仓库配置 [mariadb] name = MariaDB baseurl = http://yum.mariadb

Why so many collisions with the MariaDB 10.2 RAND() function?

人盡茶涼 提交于 2021-02-05 09:41:38
问题 Note: Running MariaDB 10.2.27 on Windows Server 2012 R2 Standard. I wanted to generate random integers for use in MariaDB so I have been experimenting with the MariaDB RAND() function. Either my expectations & understanding are way off base (definitely possible!) or the MariaDB RAND() function is not very random. Using a BIGINT(20) column I wanted to generate random integers up to 16 digits in length, so I used this SQL: FLOOR(RAND()*9999999999999999)+1) . The exact SQL I use, in a loop is:

Why so many collisions with the MariaDB 10.2 RAND() function?

穿精又带淫゛_ 提交于 2021-02-05 09:41:37
问题 Note: Running MariaDB 10.2.27 on Windows Server 2012 R2 Standard. I wanted to generate random integers for use in MariaDB so I have been experimenting with the MariaDB RAND() function. Either my expectations & understanding are way off base (definitely possible!) or the MariaDB RAND() function is not very random. Using a BIGINT(20) column I wanted to generate random integers up to 16 digits in length, so I used this SQL: FLOOR(RAND()*9999999999999999)+1) . The exact SQL I use, in a loop is:

how to grant MySQL privileges only to a specific row

懵懂的女人 提交于 2021-02-05 06:46:26
问题 Imagine there is a student table student(id,name,city) I want to create a user A and grant permission only to update record where id=10. CREATE USER A ; GRANT UPDATE ON student TO A WHERE student.id=10; I tried this and it does not work. 回答1: No not a single row but a view that contains a single row which will, in turn, will update the actual real table. This can be done via specific table view per student (yes it will be a messy DB structure). Grant access to the view for this user only alow

mysql changing unique key to primary (mariadb)

元气小坏坏 提交于 2021-02-04 21:37:17
问题 I have my table users: +--------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+--------------+------+-----+---------+-------+ | userid | varchar(30) | YES | | NULL | | | lname | varchar(40) | YES | | NULL | | | fname | varchar(20) | YES | | NULL | | | system_id | varchar(12) | YES | | NULL | | +--------------------+--------------+------+-----+---------+-------+ and I want to change the system_id and the userid

mysql-主从搭建

倾然丶 夕夏残阳落幕 提交于 2021-02-04 17:55:05
环境准备 主机名 IP 系统/MySQL版本 角色 node3 192.168.210.132 CentOS7.3 / 5.5.60 Master node2 192.168.210.130 CentOS7.3 / 5.5.60 slave 一、master节点 1、 创建需要同步的数据库 mysql> create database zn; mysql > use zn; mysql > create table T1( id int ,name varchar( 20 )); 2、停止数据库服务 systemctl stop mariadb.service 3、编辑my.cnf [mysqld] log-bin=mysql-bin- master #启用二进制日志 server - id = 1 #本机数据库ID 标示 binlog - do -db= zn #可以被从服务器复制的库, 二进制需要同步的数据库名 binlog -ignore-db=mysql #不可以被从服务器复制的库 4、重启数据库服务 systemctl restart mariadb.service 5、创建同步用户并授权 MariaDB [(none)]> grant replication slave on *.* to slave@'%' identified by " 123 " ;

The used command is not allowed with this MariaDB version with local_infile ON

隐身守侯 提交于 2021-01-29 14:25:15
问题 I know, there are a couple of questions out there, that are focusing on the same Issue, but all suggested fixes are not working for me. I am running a PHP script in which I a trying to insert a CSV file into my DB using LOAD DATA INFILE like this $db = mysqli_init(); mysqli_options($db, MYSQLI_OPT_LOCAL_INFILE, true); mysqli_real_connect($db, $db_host, $db_username, $db_password, $database); $sql = "LOAD DATA LOCAL INFILE '" . $tpl_vars['filename'] . "' " . "INTO TABLE " . $table_name . " " .

MariaDB take long time to execute

北城以北 提交于 2021-01-29 12:38:50
问题 I have a table with 500 rows of data in "MariaDB-10.3.1" When i run "TURNUCATE, ALTER, DROP, RENAME" operations take a long time for execution and nothing happend, i wait 30 minutes for 500 rows of data but not finished execution. anyone can help me to solve the problem? 回答1: I use SELECT concat('KILL ', ID, ';') FROM INFORMATION_SCHEMA.PROCESSLIST WHERE `db` IN (DATABASE_NAMES); and kill all process then my query worked. Thank you all. 来源: https://stackoverflow.com/questions/64133377/mariadb